假設我有一個數組 a = [1,2,3,4,5]。我在數組中添加一個鍵,現在a同時作為數組和對象工作。const a = [1, 2, 3, 4, 5];a['key'] = 'hello';console.log(a); // [1, 2, 3, 4, 5, key: "hello"]
我如何能夠在 Javascript 中的數組中添加一個鍵?幕后發生了什么
蝴蝶不菲
2023-03-03 14:54:42