Live data from Hacker News

ES6: The features I'm most excited about

justicen.com

1–10 of 144 posts

Re: ES6: The features I'm most excited about

#2
My 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

#4
Even 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

#8
post #6
post #3

Promises 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

#9
I 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);
Post reply on HN