未來Miral
2016-11-03 11:26
var tddate = new Date();
document.write(tddate);
var week=['星期天','星期一','星期二','星期三','星期四','星期五','星期六'];
var weekend=tddate.getDay();
document.write(week[weekend]+'<br>');
var scoreStr = "小明:87;小花:81;小红:97;小天:76;小张:74;小小:94;小西:90;小伍:76;小迪:64;小曼:76";
var list = scoreStr.split(';');
var sum = 0;
var score = new Array();
for(var i=0;i<list.length;i++)
{
score[i]=list[i].substr(7);
sum=sum+parseInt('score[i]',10);
}
score[i]=list[i].substr(7);改成score[i]=list[i].substr(-2);从倒数第二个字符开始抽取
sum=sum+parseInt('score[i]',10);去掉单引号sum=sum+parseInt(score[i],10);
JavaScript进阶篇
468195 学习 · 21891 问题
相似问题