Can node.js and JS Frameworks make use of ES6 out of the box?

Question!

I read that ES6 was released as and a lot of web browsers support it, I want to now if I can use ES6 features and syntax out of the box in the newest version of node.js and js frameworks like angular.js or react.js ?



Answers

Yes! Before we started getting all gitty about Harmony and Babel, CoffeeScript has been spearheading the future for years already. So as a rule of thumb, just ask yourself: can I use CoffeeScript here? The answer, as I said, is most likely yes!

Caveat emptor: depending on the context where your using ES6, you might want to ask yourself what qualifies as being useful at the moment.

For instance, React.js has great support for ES6 classes, but unfortunately there is no support for mixins and you'll have to resort to writing higher-order components instead; Node.js has support for generators, but the implementation may not be as mature in terms of performances, etc.



Right now you need to use something to compile your ES6 to ES5. For example this: https://babeljs.io/.

Here is a seed (without docs yet) that uses babeljs.

https://github.com/ottogiron/node-hapi-seed

With that you can write ES6 and feel like you are using it "out of the box".

By : Gepser


This video can help you solving your question :)
By: admin