使用function方法可以创建对象,这时this代表当前构造的对象
function test {
this.word = "this is a test";
}
ice_berg16 = new test;
alert(ice_berg16.word);
function test {
this.word = "this is a test";
}
ice_berg16 = new test;
alert(ice_berg16.word);
this.word = "this is a test";
}function 表示创建一个test类
this表示创建一个这个类
this.word表示创建一个word属性
在其它函数的this也表示指向class中的属性.
推荐的这个文章看起来是最详细的
不过看不太懂E文
哪位大哥麻烦您翻译一下?