Skip to content

Instantly share code, notes, and snippets.

es6 - new variable declarations - let and const - 1.js
// declare variable "firstname"
var firstname = 'John';
console.log(firstname) // outputs: "John"
// re-declare the same variable "firstname" with different value
var firstname = 'Jane';
console.log(firstname) // outputs: "Jane"
// re-assign the value of "firstname"
firstname = 'Jack';
console.log(firstname) // outputs: "Jack"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment