标签:define cti on() elf pre log class var self
function fn1(x){
arguments[0]=2;
alert(x);
}
fn1(1);//2
var x=0;
var f=function (){x=1;}
f();
alert(x);//1
function f(){x=2;}
f();
alert(x);// 1 1
var myObject={
foo:‘abc‘,
fun:function () {
var self=this;
alert(this.foo);
alert(self.foo);
(function(){
alert(this.foo);
alert(self.foo);
}());
}
}
myObject.fun();//abc abc undefined abc
var abc=function(){
alert(4);
};
function abc(){
alert(5);
};
abc();//4
function abc(){
alert(5);
};
abc();//5
function f(){
x=2;
}
f();
alert(x);//2
标签:define cti on() elf pre log class var self
原文地址:http://www.cnblogs.com/SunShineM/p/6081196.html