Lucifer_竹岚
2016-05-27 16:10
忽略掉全都是一样的信息这个“bug”,嫌麻烦所以复制的,题目是:输出所有是大一的女生,请问这代码哪写错了,为啥一个都输出不了呢,请指正
var infos[["小a","女",21,"大一"],["小b","女",21,"大一"],["小c","女",21,"大一"],["小d","女",21,"大一"],["小e","女",21,"大一"],["小f","女",21,"大一"],["小g","女",21,"大一"],["小h","女",21,"大一"],["小i","女",21,"大一"],["小j","女",21,"大一"]];
for(var i=0;i<infos.length;i++){
var jr=infos[i][3];
var wx=infos[i][1];
if(wx=="女" && jr=="大一"){
document.write(infos[i]+"<br/>");
}
}
var infos后面少了个"="
定义数组的时候少了个 “=”
定义数组的时候没有赋值号
定义二维数组的时候,需要加等号
var infos = [["小a","女",21,"大一"]...]
JavaScript进阶篇
468060 学习 · 21891 问题
相似问题