Javascript Questions

Javascript
To have a deep understanding of Javascript by some questions gathering from websites.

Key word “this”

Q1

Given codes:

1
2
3
4
5
6
7
8
9
var a=10;
function test(){
a=5;
alert(a);
alert(this.a);
var a;
alert(this.a);
alert(a);
}

What’s the output of test() and new test()?

http://blog.csdn.net/qq29655344/article/details/77145832

http://www.cnblogs.com/chenjinxinlove/p/6249593.html

http://t240178168.iteye.com/blog/1633344

https://www.jianshu.com/p/08e1b15bc883

https://gist.github.com/lyuehh/8169246

https://gist.github.com/MattSurabian/8867307

0%