Posts

Showing posts with the label ES2017 ES8

JavaScript - ES2017 (aka ES8)

The ES2017 ECMAScript 2017, edition 8 of the ECMA-262 Standard (also commonly called  ES2017  or  ES8 ), was finalized in June 2017. Compared to ES6, ES8 is a small release for JavaScript, but still it introduces very useful features: String padding Object.values() Object.entries() Object.getOwnPropertyDescriptors() Trailing commas in function parameter lists and calls Async functions Shared memory and atomics String padding The purpose of string padding is to  add characters to a string , so it  reaches a specific length . ES2017 introduces two  String  methods:  padStart()  and  padEnd() . padStart ( targetLength [ , padString ] ) padEnd ( targetLength [ , padString ] ) Sample usage: 'abc'.padStart(4) // ' abc' 'abc'.padStart(6) // '   abc' 'abc'.padStart(6,'xyz') // 'xyzabc' 'abc'.padEnd(4) // 'abc ' abc.padEnd(6) // 'abc   ' abc.padend(6,'xyz') // 'a...