Compile ES2015 block scoping (const and let) to ES5
$ npm install babel-plugin-transform-es2015-block-scoping
.babelrc
(Recommended).babelrc
{
"plugins": ["transform-es2015-block-scoping"]
}
$ babel --plugins transform-es2015-block-scoping script.js
require("babel-core").transform("code", {
plugins: ["transform-es2015-block-scoping"]
});