Skip to content

Instantly share code, notes, and snippets.

@ma-9
Created November 1, 2019 18:29
Show Gist options
  • Save ma-9/ebe0a3bd95881de50b4d781f2889c042 to your computer and use it in GitHub Desktop.
Save ma-9/ebe0a3bd95881de50b4d781f2889c042 to your computer and use it in GitHub Desktop.
JavaScript ES8 Features (padStart and padEnd)
// padStart and padEnd
const String = '12345678';
// padStart will add string/padding at the start to justify the Required Length
console.log(String.padStart(10,'.'));
// Output :- ..12345678
// padEnd will add string/padding at the end to justify the Required Length
console.log(String.padEnd(10,'.'));
// Output :- 12345678..
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment