+ 2

var x=2, obj={ x:1, change:function(){ var x=3; } } obj.change(); alert(obj.x);

//output= 1 //do u have any explanation?

24th Jun 2017, 4:17 PM
islam moheb
islam moheb - avatar
5 Respuestas
+ 9
obj.x /*(1)*/ will be alerted because the function change() isn't called in alert. I hope you got it.
24th Jun 2017, 4:39 PM
Biraj Patel
+ 3
Yes, It would be far easier to read. Plus you can't see the question without going on the post.
24th Jun 2017, 6:14 PM
Rrestoring faith
Rrestoring faith - avatar
+ 2
Please put the code in the description instead of the title next time.
24th Jun 2017, 5:13 PM
Rrestoring faith
Rrestoring faith - avatar
+ 1
would it differ, Rrestoring?
24th Jun 2017, 6:12 PM
islam moheb
islam moheb - avatar
+ 1
ok
24th Jun 2017, 6:16 PM
islam moheb
islam moheb - avatar