本文介绍了另一个var中的setDate方法返回不同的值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这些为什么不一样?
var now = new Date();
now.setDate(3);
console.log(now) //returns formatted date depending on current date
And。 ..
var now = new Date();
var day = now.setDate(3);
console.log(day) //returns just numbers
??!
推荐答案
因为setDate返回它应该的内容,所以。
Because setDate returns what it's supposed to, which is the number of milliseconds from epoch.
这篇关于另一个var中的setDate方法返回不同的值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!