使用变量作为关联数组键名该怎么做

2025-05-14 03:53:15
推荐回答(1个)
回答1:

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

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