How to check for an undefined object property in JavaScript?

I need to know what is the best way to check for an undefined object property in JavaScript.

Comments

  • if (typeof something === "undefined") {
        alert("something is undefined");
    }
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion