Why is won't work explanation
//Objects
//keyword this
//let name = 'john';
//let age = 43;
//Object example
let user = {
name: 'Gary',
lastName: 'Fitzwater',
age: 50,
cars: ['BMW', 'Audi'],
misc: {
hobbies: ['skating', 'boxing'],
lang: 'arabic'
},
salute: function(){
console.log(`Hi there I am ${name} I am ${age} years old`);
}
};
//this will not work as it is attempting to find variables in the
//console.log that are local scope!
//if you uncomment the two variable at top it will work as it takes
//from global scope
user.salute();