Created
March 27, 2019 22:58
es6 - new variable declarations - let and const - 2.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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