const Foo = function(a){
// bar doesn't belong to any instance
function bar(){
console.log(a);
};
this.baz = function(){
console.log(a);
}
}
const f = new Foo(7);
f.baz() // print 7
Hi stackoverflows, can someone explain to me why f.baz()
can print the a
?? Having difficulty explaining this to someone else right now