qq_iDIotlive_14401682
2016-12-01 17:50
最后打印出数组为什么是document.write(arr[i])而不是document.write(arr) arr[i]表示什么意思?
你要是打印arr的话,会循坏出n次arr数组的
//数据源 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);
你的意思是不是这样?
你要是打印arr的话,会循坏出n次rr数组的
JavaScript进阶篇
468194 学习 · 21891 问题
相似问题