var, let, and const

PHOTO EMBED

Tue Jul 26 2022 13:55:53 GMT+0000 (Coordinated Universal Time)

Saved by @codewithapollo #javascript

// var -- function scope --
for (var i = 0; i < 100; i++) {
}
console.log(i)
// --still function because it has no boundaries--

// let-- scope function --
for (let i = 0; i < 100; i++) {
    console.log(i)
    // -- needs to be inside block scope "{}" otherwise it will not function -- 
} 
// const -- meaning constant it cant change
const bubbles = {x:100, y:200};
// can't change the value of bubble
const bubbles= "hello world" // can't redeclare bubbles
    //  but you can change the value of x and y
    bubbles.x = 200;
    bubbles.y = 300;
bubbles = {x:200, y:300};
content_copyCOPY

https://www.youtube.com/watch?v=2iLVFyYwyRA&list=PLRqwX-V7Uu6YgpA3Oht-7B4NBQwFVe3pr&index=2