任务:
1.通过js的内置对象得到当前日期
var date=new Date();var year=date.toString().slice(11,15);document.write(year.toString()+"年");var month=date.getMonth();month=month+1;if(month<10){document.write("0"+month+"月");}else{document.write(month+"月"); }var day=date.toString().slice(8,10);document.write(day+"日 ");var weekday=["日","一","二","三","四","五","六"];var week=date.getDay();document.write("星期"+weekday[week]);2.把字符串放进数组里更好操作
3.将成绩从数组中搓出来,求和取整并输出
这是我的效果图:
以上就是小编为大家带来的js内置对象处理_打印学生成绩单的简单实现的全部内容了,希望对大家有所帮助,多多支持~