let apple = {
color: 'green',
say(...args) {
console.log('苹果有点甜!' + this.color+args);
}
}
let banana = {
color: 'yellow'
};
// apple.say.call(banana,'yellow','blue','red');
apple.say.apply(banana,['apply','red','blue'])
// function Fruits() {}
// Fruits.prototype = {
// color: "red",
// say: function() {
// console.log("My color is " + this.color);
// }
// }
// var apple = new Fruits;
// apple.say(); //My color is red
// banana = {
// color: "yellow"
// }
// apple.say.call(banana); //My color is yellow
// apple.say.apply(banana); //My color is yellow
// Fruits.prototype.say.call(banana); //My color is yellow
// Fruits.prototype.say.apply(banana); //My color is yellow
console