在二维数组长度中,我不能像这样提到静态" object32 [(0)]"我需要使用循环概念进行迭代
var object32 = [["fgd","dsg","dsgds"],["dgfs","ewrw","zsf"],["mmm","ewrw","zsf"]];
object_len_value=object32.length;
object_len=object32[0].length;
for($i=0;$i<object_len;$i++){
console.log(object32[(0)][$i]+"="+object32[1][$i]+"="+object32[2][$i]);
}
我有二维数组值,我需要得到这样的结果
OutPut:
fgd = dgfs = mmm
dsg = ewrw = ewrw
dsgds= zsf = zsf
答案 0 :(得分:1)
检查一下。 您可以遍历数组并继续根据项索引添加到结果数组。
var object32 = [["fgd","dsg","dsgds"],["dgfs","ewrw","zsf"],["mmm","ewrw","zsf"]];
let results = []
object32.map(obj => {
obj.map((o, i) => {
results[i] = results[i] ? results[i] + ' = '+ o : o;
})
})
results.forEach(r => console.log(r));