Skip to content

Instantly share code, notes, and snippets.

es6 - new variable declarations - let and const - 2.js
// initial declaration
const firstname = 'John';
// attempt to re-declare
const firstname = 'Jane'; // Error: Uncaught SyntaxError: Identifier 'firstname' has already been declared
// attempt to re-assign
firstname = 'Jane'; // Error: Uncaught TypeError: Assignment to constant variable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment