知识点1:
nodejs的全局变量是global。知识点2:
var pet = {
words : '...';
speak : function(){
console.log(this.words);//...
console.log(this===pet);//true
}
}
pet.speak();//此时this指向调用它的pet对象
function pet(words){
this.words=words;
console.log(this.words);
console.log(this === global); // true
}
- 知识点3:
apply与call要搞懂。