node js check if value is undefined code example
Example 1: js check if undefined
let foo = undefined
//will return true
typeof foo === 'undefined'
Example 2: nodejs check if variable is undefined
if ( typeof query !== 'undefined' && query )
{
//do stuff if query is defined and not null
}
else
{
}