0

JavaScriptでネストされた配列を試したことがないので、それらのフォーマットがわかりません。これが私の配列です:

var items = [
    {"Blizzaria Warlock", "105341547"},
    {"Profit Vision Goggles", "101008467"},
    {"Classy Classic", "111903124"},
    {"Gold Beach Time Hat", "111903483"},
    {"Ocher Helm of the Lord of the Fire Dragon", "111902100"},
    {"Greyson the Spiny Forked", "102619387"},
    {"Egg on your Face", "110207471"},
    {"Evil Skeptic", "110336757"},
    {"Red Futurion Foot Soldier", "90249069"},
    {"Wizards of the Astral Isles: Frog Transformer", "106701619"},
    {"Dragon's Blaze Sword", "105351545"}
];
alert(items[2][1]);

...警告する必要がありますが、警告111903124しません。

4

2 に答える 2

6

使用する

var items = [
    ["Blizzaria Warlock", "105341547"],
    ["Profit Vision Goggles", "101008467"],
    ["Classy Classic", "111903124"],
    ...
    ["Dragon's Blaze Sword", "105351545"]
];

配列を配列に構築します。内部にあるため、構文を変更する理由はありません。

于 2013-04-19T20:00:49.390 に答える