On Thu, Jul 11, 2013 at 9:45 PM, Jorge Chamorro <[email protected]> wrote: > On 11/07/2013, at 21:02, Jean-Michel Hiver wrote: >> >> >> let foo = "bar"; >> >> Yields: >> >> function (exports, require, module, __filename, __dirname) { let foo = >> "bar"; >> ^^^ >> SyntaxError: Unexpected identifier >> at Module._compile (module.js:437:25) >> at Object.Module._extensions..js (module.js:467:10) >> at Module.load (module.js:356:32) >> at Function.Module._load (module.js:312:12) >> at Module.runMain (module.js:492:10) >> at process.startup.processNextTick.process._tickCallback >> (node.js:244:9) >> >> What am I missing here? > > 1.- `let` isn't JavaScript (yet), that's why it throws a SyntaxError. > 2.- `let` -unlike `var`- gives you block scope -instead of function scope- in > the engines that have it: spidermonkey and perhaps (?) v8 with some runtime > flag.
--harmony (or --harmony_scoping, --harmony turns on a lot of other ES Harmony features as well.) -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
