Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript check if undefined

let myVar;

if (myVar === undefined){}
  //!! Note: myVar == undefined would also check wether myVar is null 

//alternatively
if (typeof myVar === 'undefined'){ }
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #javascript #check #undefined
ADD COMMENT
Topic
Name
2+2 =