18
loading...
This website collects cookies to deliver better user experience
console.log(a); // cannot access 'a' before initialization
console.log(b); // undefined
console.log(c); // c is not defined
let a = 1;
var b = 2;
console.log(a); // This console.log(a) is in the temporal dead zone because variable *a* has not been initialized yet.
let a = 1; // this is when variable *a* is initialized. Anytime before this line is the temporal dead zone.
let a = 1;
a = 3; //this is possible
const b = 1;
b = 3; // this is NOT possible
let a;
a = 3; // this is possible
const a; //this is NOT possible
let a = {name: 'joe', age: 34};
let b = {name: 'kim', age: 30};
const c = a;
c.age = 25; // this is possible because you can change the properties in an object with const
c.school = "Diamond Bar HS" // this is possible. You can add properties as well
c = b; // this is NOT possible because you are changing what you are referring to