Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js padding

const string = "Hello";
//Padding adds pretext or suffix to string until given size is reached
console.log(string.padStart(8, "hi")); //adds prefix at start: hihHello
console.log(string.padEnd(9, "hi")) //adds suffix at end: Hellohihi
 
PREVIOUS NEXT
Tagged: #js #padding
ADD COMMENT
Topic
Name
3+1 =