How can I check whether a variable is defined in Node.js?

前端 未结 6 460
不知归路
不知归路 2021-01-31 01:18

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

6条回答
  •  情话喂你
    2021-01-31 01:48

    if ( typeof query !== 'undefined' && query )
    {
      //do stuff if query is defined and not null
    }
    else
    {
    
    }
    

提交回复
热议问题