function Animal() {
this.name = "Animal";
this.Say = function () {
console.log(this);
console.log(this.name);
}
}
function Cat() {
this.name = "Cat";
}
var animal = new Animal();
var cat = new Cat();
//animal.Say();
animal.Say.call(cat);
- is it? Calling this in animal.Say has been switched to point to the cat object, so console.log (this);
- printed cat
- console.log (this.name); printed cat
this call is so ignorant. What on earth is it? I really don"t know if you can give me an example or explain it to me, thank you