0

Why is it going into his if when the check is if its not undefined

 if (this.table !== undefined || this.table !== null) {
            this.table.destroy();
        }

Console error : Uncaught TypeError: Cannot read property 'destroy' of undefined

Ive tried

if(this.table)

But no luck either

AnthonyB2017
  • 11
  • 1
  • 2

1 Answers1

0

Use this

if(this.table && typeof this.table.destroy === 'function'){ 
   this.table.destroy();
}
Baba Khedkar
  • 141
  • 7