How to check for undefined in javascript?

Posted by chobo2 on Stack Overflow See other posts from Stack Overflow or by chobo2
Published on 2010-06-06T20:21:02Z Indexed on 2010/06/06 20:32 UTC
Read the original article Hit count: 187

Filed under:

Hi

I want to make an if statement that if the value is not defined then let it go through.

I tried

if (something != "undefined")

and

if (something !== "undefined")

However it seems to go into the if statement no matter what. If it is undefined it goes through. If it is defined it goes through. Am I doing something wrong?

© Stack Overflow or respective owner

Related posts about JavaScript