ES6: The features I'm most excited about
justicen.com
ES6: The features I'm most excited about
1–10 of 144 posts
Re: ES6: The features I'm most excited about
#2My favourite feature is promises, while it doesn't add a new syntax and you can probably add a library for it, the fact it's standardised makes a world of difference. Now that it's standardised
1. It will become the common interface for deferred operations and library authors can make assumptions that it's there.
2. ES7 Async/Await will be able to leverage this common interface.
Re: ES6: The features I'm most excited about
#3Promises I find rather ugly to read. So far Im liking arrow functions and template strings. Async/await I'm looking forward to in ES7.
Re: ES6: The features I'm most excited about
#4Even better: The arrow function example used the statement form of an arrow function, instead of the expression form, which allows you to omit the return:
// using arrow
var adder = {
num: 2,
nums: [1,2,3,4,5],
addIt() {
return this.nums.map(n => this.num + n)
}
};
console.log(adder.addIt()); // [3, 4, 5, 6, 7]
I'll concede that the arrow function is a bit overly complicated, with this, sometimes-optional argument list parenthesis, and object literal/function body syntax ambiguity.Re: ES6: The features I'm most excited about
#5Wow. I can't believe template strings (https://developer.mozilla.org/en-US/docs/Web/JavaScript/Refe...) aren't in this list. I'm incredibly excited to start having those at my disposal.
Re: ES6: The features I'm most excited about
#6Promises I find rather ugly to read. So far Im liking arrow functions and template strings. Async/await I'm looking forward to in ES7.
What exactly did you have in mind other than "new Promise()" to create a promise?
Re: ES6: The features I'm most excited about
#7I've used ES6 and prefer coffeescript - IMHO more concise, easier to read, and has been place for years.
Re: ES6: The features I'm most excited about
#8Promises I find rather ugly to read. So far Im liking arrow functions and template strings. Async/await I'm looking forward to in ES7.
What exactly did you have in mind other than "new Promise()" to create a promise?
its not creating a promise that is the problem, its consuming.
Async/await really is a nice sugar, check it out when you have a chance.
Re: ES6: The features I'm most excited about
#9I was just talking to my friend who works at NetFlix on the frontend team about ES6, he is most excited about destructuring `let { name, age, gender } = user;`. I however advocate that the new class syntax is the best part of ES6. Take the following trivial OOP example, which I think reads so much easier a lot like PHP.
"use strict";
class Vehicle {
constructor(name) {
this.kind = 'Vehicle';
this.name = name;
}
printName() {
console.log(this.name);
}
}
class Car extends Vehicle {
constructor(name) {
super(name); //call the parent method with super
this.kind = 'Car';
}
}
let myCar = new Vehicle('Mercedes');
console.log(myCar);Re: ES6: The features I'm most excited about
#10I've used ES6 and prefer coffeescript - IMHO more concise, easier to read, and has been place for years.
Yup. It's as if coffeescript was created by one person (and a bunch of great PRs!), while ES6 came out of a committee.