obj[sAttr0] = () => {
return ++obj[sAttr0];
};
这段函数怎么理解?
console.log(obj[sAttr0]());
为什么输出NaN
return ++obj[sAttr0];
这里有什么用
let obj = {};
let sAttr0 = Symbol("hehe");
let sAttr1 = Symbol("meme");
obj[sAttr1] = 1;
console.log(sAttr1);
console.log(obj[sAttr1]);
obj[sAttr0] = () => {
return ++obj[sAttr0];
};
console.log(obj[sAttr0]);
console.log(obj[sAttr0]());
慕妹3146593
相关分类