3

When I try using let it returns this:

(function (exports, require, module, __filename, __dirname) { let i = 0;
                                                              ^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:414:25)
    at Object.Module._extensions..js (module.js:442:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:467:10)
    at startup (node.js:134:18)
    at node.js:961:3

I heard v4 had ECMAScript 6 support with no need for babel.

1 Answers1

5

You need to be in strict mode (see your error message) to use ES6 features:

"use strict";
let yourcode = "here";

EDIT: Thanks @user5448026, I totally messed it up here.

slomek
  • 4,873
  • 3
  • 17
  • 16