Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Adding whitespace to the left of the string in JavaScript

function yelling(message){
	try {
		console.log(message.toUpperCase().repeat(3));
		document.write(message.toUpperCase().repeat(3));
		document.write('<br>');

	} catch(e) {
		console.log(e);
		console.log("Pass a string only!");

		document.write(e);
		document.write('<br>')
		document.write("Pass a string only!");
		document.write('<br>')
	}
}
//------ ADDING "WHITESPACE" ------
let pesan = 'Hello-Universe!'
let pesanTeriakTeriak = pesan.padStart(20, '    '); //--- adding whitespce to the left of the string
//------ Executing the Function "yelling" -------
yelling(pesanTeriakTeriak);
yelling(1243252364);
Source by thewebdev.info #
 
PREVIOUS NEXT
Tagged: #Adding #whitespace #left #string #JavaScript
ADD COMMENT
Topic
Name
6+7 =