var score=[];
for(var i=0;i<3;i++){
var num=prompt("请输入成绩");
score.push(num);
document.write("第"+ (i+1)+"成绩是" + +num+"<br>")
}
var max=score[0];
var min=score[1];
var sum=0;
for(var i=0;i<score.length;i++){
if(max<score[i]){
max=score[i];
}
if(min>score[i]){
min=score[i]
}
sum=+sum + +score[i];
}
document.write("最高分:"+max +"最低分:"+min +"<br>"+"平均分:"+(sum/score.length));
var aa=["aa","bb","cc","dd"]; aa.push("ee") console.log(aa.length); var aa=["aa","bb","cc","dd"]; var bb=["qq","rr"]; console.log(aa.concat(bb)); var aa=[2,6,3,7,1]; console.log(aa.sort()); console.log(aa.sort(function(a,b){return(b-a)})); var aa=["aa","bb","cc","dd"]; console.log(aa.join("-"));
练习2
var aa=new Array(); aa[0]="我"; aa[1]="爱"; aa[2]="你"; document.write(aa+"<br>"); var bb=["我","爱","你"]; document.write(bb.reverse()+"<br>"); var cc=[2,3,4,5,6,7,8,9,10,11]; var dd=[]; document.write(dd.concat(cc));