javascript - check for undefined not working -


i started programming javascript no long ago. still confused way handles arrays. problem have array in there content undefined. want check undefined values , escape them. how do it. following code not working , have not found way solve problem.

if(myarray[0]!=='undefined')  if(myarray[0])!='undefined') // have tried   if(myarray[0]).search('undefined')==(-1)) // , 

however none of these options working. see when debugging value in array 'undefined' condition never met. once again aim when not undefined. please how it. found similar question test if not undefined in javascript not work

you comparing undefined 'undefined', string different. need compare this:

myarray=[undefined]; if(myarray[0]!==undefined){     console.log(4) } 

Comments

Popular posts from this blog

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -