for(i=0;i<arr.length;i++){ document.write(arr[i]+'<br/>'); }
最后打印出数组为什么是document.write(arr[i])而不是document.write(arr) arr[i]表示什么意思?
最后打印出数组为什么是document.write(arr[i])而不是document.write(arr) arr[i]表示什么意思?
2016-12-01
//数据源 var infos=[["小A","女",21,"大一"],["小B","男",23,"大三"],["小C","男",24,"大四"],["小D","女",21,"大一"],["小E","女",22,"大四"],["小F","男",21,"大一"],["小G","女",22,"大二"],["小H","女",20,"大三"],["小I","女",20,"大一"],["小J","男",20,"大三"]]; //定义空数组接数据 var arr = []; for(var i=0;i<infos.length;i++){ //用if过滤 if(infos[i][3] == '大一'){ arr.push(infos[i]); } } document.write(arr);
你的意思是不是这样?
举报