call、apply、bind方法用来处理函数内部的this指向问题
在(https://www.cnblogs.com/qimuz/p/12740831.html)中介绍了用构造函数来创建对象,其中里面的this指的是谁调用this,它就指向谁。
function animal() {}
animal.prototype = {
color: "grey",
look: function() {
console.log("It's color is " + this.color);
}
};
var dog = new animal();
dog.look(); // It's color is grey
var cat = new animal();
cat.look(); // It's color is grey