Diff between var & let

PHOTO EMBED

Sat Jan 08 2022 16:22:55 GMT+0000 (UTC)

Saved by @KCM #undefined

var x = 1;
var x = 4;
console.log(x); //4
//can be overwritten in a large codebase.
//it's of the global scope.

let y = "happy";
let y = "guy";
console.log(y); //SyntaxError: 'y' has already been declared
//can't be overwritten unless explicitly.
//it's of the local scope in a block of code. 

												     ✌KCM
content_copyCOPY

https://carbon.now.sh/?bg