Use next generation JavaScript features in old browsers with Babel compiler

Use next generation JavaScript features in old browsers with Babel compiler

Babel is a transpiler for JavaScript best known for its ability to turn ES6 (the next version of JavaScript) into code that runs in your browser (or on your server) today. For example the following ES6 code:

const input = [1, 2, 3];
console.log(input.map(item => item + 1)); // [2, 3, 4]

is compiled by Babel to:

var input = [1, 2, 3];
console.log(input.map(function (item) {
  return item + 1;
})); // [2, 3, 4]

Which runs in just about any JavaScript environment.

Babel lets you use virtually all of the new features that ES6 brings today, without sacrificing backwards compatibility for older browsers. It also has first class support for dozens of different build & test systems which makes integration with your current toolchain very simple.

Thanks to Bardia Rastin and his good workshop about ES6


要查看或添加评论,请登录

Mojtaba Arvin的更多文章

社区洞察

其他会员也浏览了