How it works...

The Babel project provides a compiler, commonly known as a transpiler. A transpiler is a program that ingests source code and produces some target code. The most common use for the Babel transpiler is to take JavaScript source files and translate newer features.

When the transpiler sees an expression that uses a language feature that needs to be translated, it produces a logically equivalent expression. The produced expressions can be very similar, or very different from the source expression.

For more details on how to use Babel to support different platforms, look at its website at:  https://babeljs.io/.

Get ECMAScript Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.