String padStart() and padEnd()
Widely available
The padStart()
and padEnd()
methods of strings return a string lengthened to a minimum number of characters by adding characters to the start or end of the string.
To learn more, see
String.prototype.padEnd(),
String.prototype.padStart() at MDN.
Compatibility (view on caniuse.com)
- Chrome 57 Released on 2017-03-09
- Chrome Android 57 Released on 2017-03-16
- Edge 15 Released on 2017-04-05
- Firefox 48 Released on 2016-08-02
- Firefox for Android 48 Released on 2016-08-02
- Safari 10 Released on 2016-09-20
- Safari on iOS 10 Released on 2016-09-13
Specifications
- ECMAScript Language Specification (#sec-string-objects), from TC39 (Ecma International).