标签:rip function code class 全局变量 color logs 全局 his
1 /* 2 在js中 函数里的this 指的是调用这个函数的对象 3 只是在运行的过程中 谁调用了这个函数,this对象就是谁 4 */ 5 function test(){ 6 this.k = 10; 7 } 8 //在这里调用test 实际上调用者是window对象 9 //在调用之后,全局变量也就具有了这个k 10 test(); 11 alert(k);
标签:rip function code class 全局变量 color logs 全局 his
原文地址:http://www.cnblogs.com/Lin-Yi/p/7427021.html