您的位置:首页技术文章
文章详情页

我输入if语句的时候,流浪器报错

浏览:64日期:2024-06-01 10:59:36

问题描述

VM345:1 Uncaught ReferenceError: time is not defined at <anonymous>:1:5

这是什么意思老师?

问题解答

回答1:

需要先定义时间,老师是提前定义好的

var a=new Date()

undefined

time=a.getHours()

9

if(time<12)

{

x="你好";

}

"你好"

这样就可以了