Here is mystic behavior of JavaScript. Does it my mistake of usage or some bug?
JavaScript code
function test(){
var self = this;
self.func1 = function(){
debugger; // here self == Window
}
debugger; //here self == test func
self.func1();
}
var t = new test();
I provided JSfiddle that you can try it by yourself:
https://jsfiddle.net/stanislavmachel/f44zbvvr/8/
Could somebody explain why context of self variable miss after call?