一个小例子
function speak(line){
console.log(`The ${this.type} rabbit says '${line}' you ${this.type}`);
}
let whiteRabbit = {type: "white", speak, type: "asshole"};
whiteRabbit.speak("OH my dear" + " how you smell ");
输出意外
The asshole rabbit says 'OH my dear how you smell ' you asshole
为什么不归还白兔子?
最终的对象是
它与数组相同
Therefore - simply rename the property to
type1
for example or use a stack of values.