javascript - Detecting an undefined object property -


what's best way of checking if object property in javascript undefined?

use:

if (typeof === "undefined") {     alert("something undefined"); } 

if object variable have properties can use same thing this:

if (typeof my_obj.someproperties === "undefined"){     console.log('the property not available...'); // print console } 

Comments

Popular posts from this blog

magento2 - Magento 2 admin grid add filter to collection -

Android volley - avoid multiple requests of the same kind to the server? -

Combining PHP Registration and Login into one class with multiple functions in one PHP file -