问答详情
源自:7-23 编程练习

亲测已成功!

var mysum=0,

scoreA = new Array(),

scoreStr = "小明:87;小花:81;小红:97;小天:76;小张:74;小小:94;小西:90;小伍:76;小迪:64;小曼:76",

len = scoreStr.length,

date = new Date(),

y = date.getFullYear(),

mth = date.getMonth() + 1,

day = date.getDate(),

week = date.getDay();

switch (week) {

case 0: week = '日'

break;

case 1: week = '一'

break;

case 2: week = '二'

break;

case 3: week = '三'

break;

case 4: week = '四'

break;

case 5: week = '五'

break;

case 6: week = '六'

break;

}

document.write(scoreStr.length + '<br/>');

for (var i = 3; i < len; i += 6) {

scoreA.push(scoreStr.slice(i, i + 2));

}

console.log(scoreA)

for (var j = 0; j < scoreA.length; j++) {

mysum = mysum + parseInt(scoreA[j]);

}

document.write(y + '年' + mth + '月' + day + '日' + ' ' + '星期' + week + '- -' + '班级总分为:' + mysum);


提问者:慕运维9098251 2018-12-30 13:30

个回答

  • 一只傻吴笛
    2019-01-01 19:46:15

    看别的同学的笔记就好