JavaScript Internals (521 Qs)•Part 7: Execution Context, Functional JS & V8 Engine (404 - 463)
What is babel
Babel is a JavaScript transpiler to convert ECMAScript 2015+ code into a backwards compatible version of JavaScript in current and older browsers or environments. Some of the main features are listed below,
- Transform syntax
- Polyfill features that are missing in your target environment (using @babel/polyfill)
- Source code transformations (or codemods)
Practical Code Example
javascript
// Babel: JavaScript transpiler converting modern ESNext / JSX syntax into backwards-compatible ES5:
// Modern Input:
const greet = (name) => `Hello ${name}`;
// Transpiled Output:
// var greet = function(name) { return "Hello " + name; };