Tuesday, 20 May 2014

How to check undefined value in Jquery


Checking undefined value in Jquery

Note that typeof always returns a string, and doesn't generate an error if the variable doesn't exist at all.
function A(val){
  if(typeof(val)  === "undefined")
    //do this
  else
   //do this
}


No comments:

Post a Comment