我有一项任务,要求我通过编程创造奇迹。我无法在网上找到任何答案,因为我不知道它的搜索词(尝试过方法中的方法等...)。感谢所提供的任何帮助!
这就是我得到的:我需要创建一个基于自身构建的类。例如
const pineapple = new Item('pineapple');
pineapple.type = fruit // this is simple
pineapple.is_a.fruit = true // this I do not know
pineapple.is.heavy = true // same thing
我什至不知道从哪里开始。我的尝试与此类似,但我变得不确定。
class Thing {
constructor(type) {
this.type = type;
}
is_a(bool) {
this.fruit = this.is_a(bool);
}
}
蛊毒传说
相关分类