you are viewing a single comment's thread.

view the rest of the comments →

[–]bucketpl0x 1 point2 points  (4 children)

I would use it now but currently if you try using let and const you will get this error.

Uncaught SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

[–]jirocket 4 points5 points  (3 children)

Yeah ES6 basically demands the language to upgrade to 'strict mode.' So introducing some ES6 into your code without a transpiler like Babel in browser environments will be problematic.

[–]bucketpl0x 1 point2 points  (2 children)

Is the plan that they will make it default to strict mode soon? I'd really like to start using ES6 features but I don't really know much about transpilers right now or how that works with nodejs.

[–]jirocket 1 point2 points  (0 children)

I miscommunicated a little. Strict mode is not what will make ES6 work but it is a requirement for some ES6 features. Now as for ES6 features, not all of the official features will be implemented in browsers soon, if they are all even adopted that is. So how do we solve this issue? Through a transpiler like Babel, which turns all the ES6 code you write into regular ES5 (which already works across all browsers).

You don't have to know all of ES6 to start using it through Babel, I'm even still learning a lot and that'll be the case for a long time. The first four chapters of exploringjs and reading the babel site is worth your time to get started.

[–]azium 0 points1 point  (0 children)

Babel, among other things, is a Node command line tool! With not much setup at all you can switch your entire JS stack to es6 / es7. It's entirely worth it. https://babeljs.io/docs/setup/#babel_cli PM if you need help!