JS 用变量作为关联数组的索引

2025-05-14 00:39:42
推荐回答(1个)
回答1:

关联数组类似对象,遍历关联数组,可以用for...in语法:

for(var key in data){
    console.log(key +  ':' + data[key]);
}