The ECMAScript 2017 Language Specification – the 8th edition of the spec – was officially released at the end of June by TC39.
💁♂️ ICYWW: Should we say ES2017 or ES8?
→ Say ES2017. Back in the day ES6 was (and still is) used a lot to refer to ES2015, but one should be referring to the standard using the year references (or refer to a language feature using its name)
One of the top additions – which I’ve been using for quite a while now thanks to babel-polyfill and its included core-js – is Object.entries()
/Object.values()
, as they have rather big effect on the way I write my code.
const obj = { x: 'xxx', y: 1 };
Object.values(obj); // ['xxx', 1]
const obj = { x: 'xxx’, y: 1 };
Object.entries(obj); // [[’x’, 'xxx’], [’y’, 1]]
As it’s an array, one can easily append a .forEach(…)
to each one of these beauties to get going … And don’t forget about map/reduce/filter either 😉
Async functions is also at the top of my list of influential features:
function fetchTextByPromise() {
return new Promise(resolve => {
setTimeout(() => {
resolve("ES2017");
}, 2000);
});
}
async function sayHello() {
const externalFetchedText = await fetchTextByPromise();
console.log(`Hello, ${externalFetchedText}`); // Hello, ES2017
}
sayHello();
Furthermore some new string padding functions, Object.getOwnPropertyDescriptors(obj)
, “Trailing commas in function parameter lists and calls”, and “Shared memory and atomics” has been added.
ES8 was Released and here are its Main New Features →
ECMAScript 2017 Language Specification (PDF) →
Consider donating.
I don’t run ads on my blog nor do I do this for profit. A donation however would always put a smile on my face though. Thanks!
Leave a comment