var ---VS--- let
var
This keyword, which defines a variable globally, or locally to an entire function regardless of block scope.function test(){
for (var i = 0; i < 10; i++) {
// some code
console.log("In block scope"+ i); // output: 0 to 9
}
console.log("In local scope" + i); // output: 10
}
let
It allows you to declare variables that are limited in scope to the block, statement, or expression on which it is used.function test(){
for (let i = 0; i < 10; i++) {
// some code
console.log("In block scope"+ i); // output: 0 to 9
}
console.log("In local scope" + i); //Uncaught ReferenceError: i is not defined
}
ReplyDeleteReally very happy to say, your post is very interesting to read. I never stop myself to say something about it. You’re doing a great job. Keep it up.mobile phone repair in Auburn Hills
iphone repair in Auburn Hills
cell phone repair in Auburn Hills
tablet repair in Auburn Hills
ipad repair in Auburn Hills
mobile phone repair Auburn Hills
iphone repair Auburn Hills
cell phone repair Auburn Hills
phone repair Auburn Hills
tablet repair Auburn Hills
cheap hidden cameras
ismartalarm camera
dymo label maker
Waterproof Action Camera
Coleman full size air mattress
womens cotton long johns
APPLE WATCH SERIES 3 INFORMATION
Winter Cycling Jackets For Men