我需要在對象內有一個類,與點表示法一起使用。是否可以?還有其他方法可以達到相同的結果嗎?例子:const Obj { info(i) { console.log(i); }, class Num { constructor(n) { this.n = n || 5; } run() { console.log(this.n); } }}const n = new Obj.Num();
在對象內部擁有類
慕娘9325324
2023-07-06 14:35:53