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

求大神帮忙,为什么没输出结果?

var mydate=new Date();

var weekday["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];

document.write(mydate.getFullYear()+"年"+mydate.getMonth()+1+"月"+mydate.getDate()+"日"+weekday[mydate.getDay()]);


提问者:慕妹6610264 2017-12-10 16:39

个回答

  • weibo_笑着迈大步_0
    2017-12-13 15:43:22

    weekday变量定义时候出错,少了等号。

  • qq_夜夜夜夜
    2017-12-10 19:19:38

    var today=new Date();

      var weekday=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];

      document.write(today.getFullYear()+"年"+today.getMonth()+"月"+today.getDate()+"日 "+weekday[today.getDay()]+"--班级总分为:");  

    这是我写的,你mydate.getMonth()+1是什么意思呢


  • 梦里芊寻
    2017-12-10 19:15:10

    等号没加

  • 慕UI3735678
    2017-12-10 18:52:48


    var mydate=new Date();

    var weekday=["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];

    document.write(mydate.getFullYear()+"年"+mydate.getMonth()+1+"月"+mydate.getDate()+"日"+weekday[mydate.getDay()+1]);