//EXAMPLE ONE
// var num=0;
// console.log(i); //what is this?
// //not defined
// //undefined THIS ONE
// //NaN
// for (var i=0; i<5; i++){
// num += i;
// }
// 0 + 1 + 2 + 3 + 4
// num = 0+0
// num = 0+1
// num = 1+2
// num = 3+3
// num = 6+4
// console.log(num); //10 THIS ONE, 6, 5
// console.log(i); //4, 5 THIS ONE
//EXAMPLE ONE with es6
var num=0;
//i is not defined
//console.log(i);
for (let i=0; i<5; i++){
num += i;
}
console.log(num);
//i is not defined
//console.log(i);
const name = "frank";
//these will give you
//TypeError: Assignment to constant variable.
// name += "hi";
//name = "dfdsf"
const boo = true;
//TypeError: Assignment to constant variable.
//boo = false;
const numOfFastAndFuriouses = 8;
//TypeError: Assignment to constant variable.
//numOfFastAndFuriouses++;
const coolMoviesToSee = ["split", "power rangers", "beauty and the beast", "get out", "life"];
//TypeError: Assignment to constant variable.
//coolMoviesToSee = "hello";
coolMoviesToSee.push("double dragon");
const rich = {
name : "rich"
}
rich.lastName = "Spence";
// function addThreeToIt(a){
// // a is 1
// let num = 3;
// return num + a;
// }
function addThreeToIt(a){
// a is 1
// num is undefined here because it's a let
let num = 3;
num += a;
return num;
}
let number = addThreeToIt(1);
console.log(number);