标签:log java www ati 语法 join and 不同 参考
function Product(name, price) {
this.name = name;
this.price = price;
}
function Food(name, price) {
Product.call(this, name, price);
// <==> Product.apply(this, [name, price]);
// <==> Product.bind(this, name, price)();
this.category = 'food';
}
console.log(new Food('cheese', 5));
function greet() {
var reply = [ this.animal, 'typically sleep between', this.sleepDuration ].join(' ');
console.log(reply);
}
var obj = {
animal: 'cats', sleepDuration: '12 and 16 hours'
};
greet.call(obj); // cats typically sleep between 12 and 16 hours
标签:log java www ati 语法 join and 不同 参考
原文地址:https://www.cnblogs.com/mazhaokeng/p/11518825.html