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
Post a Comment