js中如何获取当天是星期几?

方法一:使用Date的getDay()

const now = new Date();
now.getDay();

getDay()会返回0~6,其中0是星期日,1~6分别对应星期一到星期二