Use next generation JavaScript features in old browsers with Babel compiler
Mojtaba Arvin
Sr. Software Engineer | Backend Developer in Python | Expert in FastAPI, Django, AWS, PostgreSQL & Redis | Built scalable APIs & microservices using Docker & K8s | Passionate about cloud, IaC, DevOps & MLOps
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