Babel is a general purpose JavaScript compiler that allows code written for modern versions of JavaScript to be compiled into a backwards compatible format that can run on older JavaScript environments. It uses parsing, traversing an abstract syntax tree (AST), and code generation to transform code. Key parts of Babel include its parser, types module for working with AST nodes, visitor pattern for traversing nodes, and ability for third-party code (plugins) to transform the AST during parsing.
63. var global = "I am in the global scope";
function scopeOne() {
var one = "I am in scope one";
function scopeTwo() {
var two = "I am in scope two";
}
}
64. function scopeOne() {
var one = "I am in scope one";
function scopeTwo() {
one = "I updating a ref in scope one";
}
}
65. function scopeOne() {
var one = "I am in scope one";
function scopeTwo() {
var one = "I am creating a new `one`";
}
}
69. function scopeOnce() {
var ref = "This is a binding";
ref; // This is a reference to a binding
function scopeTwo() {
ref; // This is a reference to a binding
}
}