小程序的这个JS方法为啥有的时候会报错?
发布于 5 年前 作者 yitao 936 次浏览 来自 问答

new Date().getTime()

这个getTime()是不能用吗?

还有个问题,请问我这样判断为啥有的时候会报错?

if (oldDate != undefined)

3 回复

(new Date()).getTime(),这样才行new Date()是一个整体,一个值。if (oldDate != undefined)这样报错的话,可能跟oldDate本身有关。

(new Date()).getTime();

    if (!oldDate){

    }else{

    }


==null不行吗

回到顶部