⛔️ Object.assign causing TypeError
Last updated
Was this helpful?
Last updated
Was this helpful?
裡面 source 物件的 methods 似乎不是可以任意寫的,當內部使用物件方法時,JS 引擎(還是 Node 環境❓)竟然會檢查型別❗️
下面的範例用了三個方法來產生一個二維陣列的「最長列長」:
✅ 使用全域函數 (global functions)
✅ 使用 Object.defineProperty()
❌ 使用 Object.assign()
但用最後一種方法 (mixin) 會出問題❗️
explanation:
(我問的)