What's Babel for in Javascript?

What's Babel for in Javascript?

Babel is a toolchain that is mainly used to convert ECMAScript 2015+ code into a backwards compatible version of JavaScript in current and older browsers or environments.

What is Babel and why use it?

Babel is a free and open-source JavaScript transcompiler that is mainly used to convert ECMAScript 2015+ (ES6+) code into a backwards compatible version of JavaScript that can be run by older JavaScript engines. ... Babel plugins are used to transform syntax that is not widely supported into a backwards-compatible version.

When should I use Babel?

You must use Babel to be sure that everyone will be able to run your code, else you can develop without it.
...
If you want to:
  1. use modules (with require() or import ... )
  2. use JSX.
  3. support a lot of browsers.
  4. use more advanced features (async/await), some still in proposals (decorators, class properties..)
James H. Sterling
Author

James H. Sterling

James Sterling reports on renewable energy developments, climate policy, ecological conservation, and green tech innovations around the globe.