有誰知道爲什麼會出錯?我一直在嘗試它太長時間,我似乎無法弄清楚。它帶有「無法讀取未定義的屬性0」的錯誤,但它有明確的定義。 (或因此我認爲)「無法讀取二維數組中的undefined屬性0」
var categorySix = [["test"]["test2"],["testing"]["one"],["two"]["three"]];
document.write(categorySix[0][0]);
有誰知道爲什麼會出錯?我一直在嘗試它太長時間,我似乎無法弄清楚。它帶有「無法讀取未定義的屬性0」的錯誤,但它有明確的定義。 (或因此我認爲)「無法讀取二維數組中的undefined屬性0」
var categorySix = [["test"]["test2"],["testing"]["one"],["two"]["three"]];
document.write(categorySix[0][0]);
var categorySix = [["test","test2"],["testing","one"],["two","three"]];
你的語法是關閉的。
哦,謝謝,我不認爲我會見過.. – wolfd
你聲明你的二維數組錯誤。
試試這個:
var categorySix = [["test","test2"],["testing","one"],["two","three"]];
你是不是正確創建陣列。
我相信它應該是
var categorySix = [["test","test2"],["testing","one"],["two","three"]];
document.write(categorySix[0][0]);
請記住所接受,如果你的問題得到解決,以紀念一個答案。 – Drazisil