Now, let's use the Babel CLI to transpile our code:
$ npx babel index.js -o compiled.js
The preceding command uses npx, a tool that was introduced with npm v5.2.0. npx allows you to run binaries install locally (within your project's node_modules directory, as opposed to globally) using a very tidy syntax. Instead of typing ./node_modules/.bin/babel index.js -o compile.js, you can shorten it to npx babel index.js -o compile.js.
Here, we are using npx to run the local babel executable, which will transpile our index.js file and output it as compiled.js.
If you compare the two files, you'll see that apart from formatting changes (such as whitespace), the two files should be identical. This is because the ...