How can I check whether a variable is defined in Node.js?
javascript, node.js
Solution
if ( typeof query !== 'undefined' && query )
{
//do stuff if query is defined and not null
}
else
{
}
Problem
I am working on a program in node.js which is actually js. I have a variable : ``` var query = azure.TableQuery... ``` looks this line of the code is not executing some times. my question is : How can I do a condition like: ``` if this variable is defined do this. else do this. ``` I cannot do in js `(query!= null)` I want to see if this variable is defined do some thing. how to do this