JavaScript的迭代我有一個數組如下:通過陣列
levelinfoarray["test"] = new Array(16,20,4,5,"Test level");
levelinfoarray[1] = new Array(29,25,17,13,"Introduction");
levelinfoarray[2] = new Array(16,24,6,4,"Counting...");
levelinfoarray[3] = new Array(16,20,4,5,"Where am I going?");
...
我想通過數組進行迭代,並獲得級別數量和級別描述這樣
Test) Test level
1) Introduction
2) Counting...
3) Where am I going?
...
我已經嘗試了對循環和forEach,但都只給我編號的條目。我將如何獲得「測試」條目?
對於JavaScript數組,混合使用數字鍵和非數字鍵是不現實的。數組都是關於數字索引的屬性。 – Pointy