Search
 
SCRIPT & CODE EXAMPLE
 

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);
Comment

PREVIOUS NEXT
Code Example
Javascript :: match regex 
Javascript :: navigator user media check if camera is availabe 
Javascript :: js if condition 
Javascript :: js number round to each 15 
Javascript :: an arrow function 
Javascript :: destructuring in es6 
Javascript :: shuffle array 
Javascript :: Remove duplicates from arrays using reduce 
Javascript :: simple user agent parse js 
Javascript :: update object in array state react 
Javascript :: express-rate-limit nodejs 
Javascript :: javascript double question mark 
Javascript :: react-native-safe-area-context 
Javascript :: react native force vertical 
Javascript :: js get path from url 
Javascript :: jsx return greatest number between two numbers 
Javascript :: How to Use the replace() String Method in javascript 
Javascript :: modal slide from right 
Javascript :: object literal js 
Javascript :: text input underline react native 
Javascript :: pass text and variable in alert javascript 
Javascript :: search with multiple field in node js mongodb 
Javascript :: send params in nested screen 
Javascript :: make file from array save js 
Javascript :: How to pass json format data on ajax call 
Javascript :: how to use react typed js 
Javascript :: check if date is less than today moment 
Javascript :: javascript remove last element 
Javascript :: vuejs copy to clipboard 
Javascript :: selialize jquery 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =