JS中,怎样用for..in来输出二维数组?

JavaScript026

JS中,怎样用for..in来输出二维数组?,第1张

var week=[["周一","周二","周三","周四","周五","周六","周日"],["吃饭","睡觉","学习"]]

for (var i = 0i <week.lengthi++) {

for (var j = 0j <week[i].lengthj++) {

document.write(week[i][j]+"<br>")

}

}

var count = 7

// 这个要移到for里面,不然每次都往这个数组里加数据

// var GYR = []

var gyr = []

for(var i = 0 i < count i++) {

    // 每次创建新的

    var GYR = []

    var XM = dataGYR.getValue("GYRXM", dataGYR.getID(i))

    var XB = dataGYR.getValue("GYRXB", dataGYR.getID(i))

    var NL = dataGYR.getValue("fGYRNL", dataGYR.getID(i))

    GYR.push(XM,XB,NL)

    gyr.push(GYR)

}

alert(gyr)