weixin_慕容9179744
2022-02-28 16:05
<!DOCTYPE HTML>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>流程控制语句</title>
<script type="text/javascript">
//第一步把之前的数据写成一个数组的形式,定义变量为 infos
var infos=[["大一","大三","大四","大一","大四","大一","大二","大三","大一","大三"],["女","男","男","女","女","男","女","女","女","男"],["小A","小B","小C","小D","小E","小F","小G","小H","小I","小J"]]
//第一次筛选,找出都是大一的信息
for(var i=0;i<infos.length;i++){
if(infos[0][i]=="大一"){
if(infos[1][i]=="女"){
document.write(infos[2][i]+"<br>");
}
}
}
</script>
</head>
<body>
</body>
</html>
因为infos.length=3,你只循环了i=0,1,2三个数,所以只有1个结果
JavaScript进阶篇
468061 学习 · 21891 问题
相似问题
回答 6
回答 2
回答 2
回答 2
回答 2