Jump to content


Photo

checking if var exsists


  • Please log in to reply
1 reply to this topic

#1 slipperyfish

slipperyfish
  • Members
  • PipPipPip
  • Advanced Member
  • 40 posts

Posted 30 March 2006 - 10:27 AM

how do you check if a variable exsists in javascript?

i no in PHP you can use:

isset($var)

is there something similar in javascript?

#2 wildteen88

wildteen88
  • Staff Alumni
  • Advanced Member
  • 10,482 posts
  • LocationUK, Bournemouth

Posted 31 March 2006 - 10:29 AM

Javascript doesnt have a pre built in function like isset. If want to check variable you'll have to do it like this:
if(varName != "")
{
    //then do something here
}
else
{
    //do something else here
}





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users