鑒于以下代碼:const civic = {make: 'Honda', model: 'Civic'};function logArgs(make, model) { console.log(make); console.log(model)}我想做這個:logArgs(...civic);代替:logArgs(civic.make, civic.model);我得到:(index):39 Uncaught TypeError: Found non-callable @@iterator有什么方法可以解構像數組這樣的對象,還是我試圖做的事情是不可能的?
在JS中像數組一樣解構對象?
牛魔王的故事
2021-10-21 14:44:48