var scoreStr = "小明:87;小花:81;小红:97;小天:76;小张:74;小小:94;小西:90;小伍:76;小迪:64;小曼:76";
var scorearr= scoreStr.split(";");
var sum =0,vag=0
for (i=0;i<scorearr.length;i++){
sum = sum +pareInt(scorearr[i].substring(scorearr[i].indexof(";")+1));
}
document.write("班级总分是:"+sum);
document.write("班级平均分是:"+Math.round(sum/scorearr.length))
慕男婶
Caballarii
相关分类