JavaScript Uncaught TypeError:无法读取属性' destroy'未定义的

时间:2017-10-14 16:01:37

标签: javascript user-interface undefined

如果检查是否未定义

,为什么会进入他的状态
 if (this.table !== undefined || this.table !== null) {
            this.table.destroy();
        }

控制台错误: 未捕获的TypeError:无法读取属性' destroy'未定义的

我试过

if(this.table)

但没有运气

1 个答案:

答案 0 :(得分:0)

使用此

if(this.table && typeof this.table.destroy === 'function'){ 
   this.table.destroy();
}
相关问题