Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

padstart and padend javascript

// padStart pads a string with a given character until a certain
// length is reached. An empty character is used if second param is omitted.
const example = 'Dylan';
console.log(example.padStart(10, 'a')); // aaaaaDylan
// padEnd would place the padding at the end
console.log(example.padEnd(10, ‘a’)); // Dylanaaaaa
 
PREVIOUS NEXT
Tagged: #padstart #padend #javascript
ADD COMMENT
Topic
Name
6+3 =