How to check for undefined or null variable in javascript
- by Thomas Wanner
We are frequently using the following code pattern in our javascript code
if(typeof(some_variable) != 'undefined' && some_variable != null)
{
// do something with some_variable
}
and I'm wondering whether there is a less verbose way of checking that has the same effect. According to some forums and literature saying simply
…