js未定义判断时间:2023-03-09 03:28:15 if (typeof(homeType) == 'undefined') { //..... //..... } typeof函数判断,如果未定义的就会返回undefined,注意undefined 要用引号;