Skip to content

Instantly share code, notes, and snippets.

@olov
Last active December 21, 2015 05:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olov/6255863 to your computer and use it in GitHub Desktop.
Save olov/6255863 to your computer and use it in GitHub Desktop.
[:~/projects/js] % cat const.js
"use strict"; // required to opt-in ES6 block scope in V8 for now
console.log("const assignment error is caught at parse-time so this doesn't get printed");
const limit = 100;
limit = 200;
console.log(limit);
[:~/projects/js] % node --harmony const.js
/Users/olov/projects/js/const.js:4
limit = 200;
SyntaxError: Assignment to constant variable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment