function F (v) {
var v = v;
this.fun = function f () {
console.log(v);
};
};
var i = new F(1);
i.fun();
Just to clarify, I don't this my question is solved by a knowledge of closures.
To my understanding, i
is just: {fun: function f () {console.log(v)}}
.
So how is i.fun()
able to access v
- one of the variables in a constructor function that only helped to make i
?