in this code below:
var a = 1;
var boat = { a:2,
innerBoat: {a:3,
print(){console.log(a);},
},
};
boat.innerBoat.print(); //output: 1
i don't understand why console.log(a); in print method returns the value 1.
Also, does the curly braces {} of the object referenced by boat creates a new private execution context in the stack at runtime ? (I know that only function calls create a new private execution context at runtime, but object creation confuses me, because they are originally a constructor call:
var boat = new Object();