Hacker News new | ask | show | jobs
by natrius 4010 days ago
Next to arrow functions and optional arguments, better object syntax is one of the big reasons you should be using Babel today. You know how sometimes you need to precalculate values that are going to be returned in an object, so at the end of the function, you return something like this?

  return {
    foo: foo,
    bar: bar,
    baz: baz
  };
You don't have to do that in ES6.

  return {foo, bar, baz};
Keys without values use variables with the same name as their values.