4-10哪个编程练习怎么做啊?,
求大神指教,小弟感激不尽
求大神指教,小弟感激不尽
2017-11-09
<!DOCTYPE HTML>
<html >
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>流程控制语句</title>
<script type="text/javascript">
var infos = [
['小A','女',21,'大一'],
['小B','男',23,'大三'],
['小C','男',24,'大四'],
['小C','男',24,'大四'],
['小D','女',21,'大一'],
['小E','女',22,'大四'],
['小F','男',21,'大一'],
['小G','女',22,'大二'],
['小H','女',20,'大三'],
['小I','女',20,'大一'],
['小J','男',20,'大三']
];
for(var i = 0; i < infos.length; i++) {
if(infos[i][3] == "大一" && infos[i][1] == "女") {
document.write(infos[i][0] + "<br />");
}
}
</script>
</head>
<body>
</body>
</html>
var infos = [['小A','女',21,'大一'],['小B','男',23,'大三'],['小C','男',24,'大四'],['小D','女',21,'大一'],['小E','女',22,'大四'],['小F','男',21,'大一'],['小G','女',22,'大二'],['小H','女',20,'大三'],['小I','女',20,'大一'],['小J','男',20,'大三']]; var names = new Array(); for(var i=0;i<j;i++){ names[i] = new Array(); for(var j=0; j<k; j++){ names[i][j] = ""; } } //第一次筛选,找出都是大一的信息 for(var i=0;i<10;i++){ if(infos[i][3] == '大一'){ names.push(infos[i]); } } //第二次筛选,找出都是女生的信息 for(var i=0; i<names.length; i++){ if(names[i][1] == '女'){ document.write(names[i][0]); } }
var infos = [['小A','女',21,'大一'],['小B','男',23,'大三'],['小C','男',24,'大四'],['小D','女',21,'大一'],['小E','女',22,'大四'],['小F','男',21,'大一'],['小G','女',22,'大二'],['小H','女',20,'大三'],['小I','女',20,'大一'],['小J','男',20,'大三']]; var names = new Array(); for(var i=0;i<j;i++){ names[i] = new Array(); for(var j=0; j<k; j++){ names[i][j] = ""; } } //第一次筛选,找出都是大一的信息 for(var i=0;i<10;i++){ if(infos[i][3] == '大一'){ names.push(infos[i]); } } //第二次筛选,找出都是女生的信息 for(var i=0; i<names.length; i++){ if(names[i][1] == '女'){ document.write(names[i][0]); } }
var tara = [['Image Dragon ','女',21,'大一'],['小B','男',23,'大三'],['小C','男',24,'大四'],['taylor ','女',21,'大一'],['小E','女',22,'大四'],['小F','男',21,'大一'],['小G','女',22,'大二'],['小H','女',20,'大三'],['Jay','女',20,'大一'],['小J','男',20,'大三']];
for (t=0;t<tara.length;t++){
if(tara[t][3]=='大一' && tara[t][1]=='女'){
document.write(tara[t][0]);
}
}
var infos=[['小A','女',21,'大一'],['小B','男',23,'大三'],
['小C','男',24,'大四'],['小D','女',21,'大一'],['小E','女',22,'大四'],
['小F','男',21,'大一'],['小G','女',22,'大二'],['小H','女',20,'大三'],['小I','女',20,'大一'],['小J','男',20,'大三']];
for(var i=0;i<infos.length;i++){
if(infos[i][3]=='大一'&&infos[i][1]=='女'){
document.write('读大一并且是女生的有:'+infos[i][0]+'<br>');
}
}
var infos [
{name:'小A',sex:'女',age:'21',cent;"大一"},
{name:'小B',sex:'女',age:'21',cent;"大2"},
{name:'小C',sex:'女',age:'21',cent;"大一"},
{name:'小D',sex:'女',age:'21',cent;"大一"}
]
//第一次筛选,找出都是大一的信息
for (var i = 0;i < infos.length;i++){
if(infos[i].cent=='大一'){
console.log(infos[i])
if(infos[i].sex=='女'){
console.log(infos[i].name)
}
}
}
举报