1425bb815Sopenharmony_ci# Converting incompatible features with Babel
2425bb815Sopenharmony_ciTo run ES6 sources with JerryScript that use unsupported language features, you can use Babel to transpile your code, which will output a semantically equivalent source file, where the unsupported features are replaced with ES5.1 code.
3425bb815Sopenharmony_ciBabel is a JavaScript compiler that is used to convert ES2015+ code into a backward-compatible version. You can find more information [here](https://babeljs.io/).
4425bb815Sopenharmony_ci
5425bb815Sopenharmony_ci## Example
6425bb815Sopenharmony_ci
7425bb815Sopenharmony_ci```javascript
8425bb815Sopenharmony_ci//Before
9425bb815Sopenharmony_ciconst fn = () => 1;
10425bb815Sopenharmony_ci
11425bb815Sopenharmony_ci//After conversion
12425bb815Sopenharmony_ci
13425bb815Sopenharmony_civar fn = function fn() {
14425bb815Sopenharmony_ci  return 1;
15425bb815Sopenharmony_ci};
16425bb815Sopenharmony_ci```
17425bb815Sopenharmony_ci## Table of Contents
18425bb815Sopenharmony_ci* **[Getting ready](#getting-ready)**
19425bb815Sopenharmony_ci  * Installing node.js and npm
20425bb815Sopenharmony_ci* **[Using babel](#using-babel)**
21425bb815Sopenharmony_ci* **[Missing features/Polyfill](#missing-features)**
22425bb815Sopenharmony_ci
23425bb815Sopenharmony_ci## Getting ready [](#getting-ready)
24425bb815Sopenharmony_ci
25425bb815Sopenharmony_ci### 1. **Node.js and npm**
26425bb815Sopenharmony_ci
27425bb815Sopenharmony_ciStart by updating the packages with
28425bb815Sopenharmony_ci
29425bb815Sopenharmony_ci`$ sudo apt update`
30425bb815Sopenharmony_ci
31425bb815Sopenharmony_ciInstall `nodejs` using the apt package manager
32425bb815Sopenharmony_ci
33425bb815Sopenharmony_ci`$ sudo apt install nodejs`
34425bb815Sopenharmony_ci
35425bb815Sopenharmony_ciCheck the version of **node.js** to verify that it installed
36425bb815Sopenharmony_ci
37425bb815Sopenharmony_ci```bash
38425bb815Sopenharmony_ci$ nodejs --version
39425bb815Sopenharmony_ciOutput: v8.10.0
40425bb815Sopenharmony_ci```
41425bb815Sopenharmony_ci
42425bb815Sopenharmony_ciNext up is installing **npm** with the following command
43425bb815Sopenharmony_ci
44425bb815Sopenharmony_ci`$ sudo apt install npm`
45425bb815Sopenharmony_ci
46425bb815Sopenharmony_ciVerify installation by typing:
47425bb815Sopenharmony_ci
48425bb815Sopenharmony_ci```bash
49425bb815Sopenharmony_ci$ npm --version
50425bb815Sopenharmony_ciOutput: 6.10.2
51425bb815Sopenharmony_ci```
52425bb815Sopenharmony_ci
53425bb815Sopenharmony_ci### 2. Using babel [](#using-babel)
54425bb815Sopenharmony_ci
55425bb815Sopenharmony_ciAssuming you're in the tools/babel folder,
56425bb815Sopenharmony_ci
57425bb815Sopenharmony_ci`$ sudo npm install`
58425bb815Sopenharmony_ci
59425bb815Sopenharmony_ciAfter installing the dependencies it is ready to use.
60425bb815Sopenharmony_ci
61425bb815Sopenharmony_ciPlace the files/directories you want transpiled to the babel folder and run
62425bb815Sopenharmony_ci
63425bb815Sopenharmony_ci`$ npm run transpile [name of input file/directory] [(OPTIONAL)name of output file/directory]`
64425bb815Sopenharmony_ci
65425bb815Sopenharmony_ciIf you want to use the same name, then only give the name once.