我理解函数的范围应该在定义时确定。
所以从我的理解来看,范围应该是范围,所以真的应该只是?但事实证明这是全球范围的。不知道为什么function(toy)forEachthisforEach
function Cat(name) {
this.name = name;
this.toys = ['string', 'ball', 'balloon'];
};
Cat.prototype.play = function meow() {
this.toys.forEach(function(toy) {
console.log(this);
});
};
const garfield = new Cat('garfield');
garfield.play();
largeQ
狐的传说
相关分类