0
Help please I don't understand this code why it print 42 then 43
var data =41; var o ={data : 42}; o.print =function(){ console.log(this.data); var print2 = function(){ console.log(this.data); } print2() ; }; var data =43 ; o.print()
5 Respuestas
+ 1
In the print2 function the keyword "this" refers to the window object. In print2 function this.data is equivalent to window.data.
0
The keyword "this" refers to the current object. In the o.print function, this.data is equivalent to o.data.
0
But why we get 42 43 as output
0
Thank you so much 👍👍👍