This question has already been answered:
- Loss of context call 5 responses
It is necessary that the function continue to work in its context:
function aaaa(v) { this.n = v; this.inscr = function() { this.n++; } this.bbbb = function(v) { var self = this; console.log(this.n); aaaa(5).inscr(); console.log(self.n); } return this; } aaaa(1).bbbb(); It is necessary that the second console.log (self.n) continue to work in its own context. That is, the first and second console.log should output the same result. Is it possible to do without "new"?
thisis thiswindow? "must output the same result" - which one? - Igor