Jump to content

Archived

This topic is now archived and is closed to further replies.

slipperyfish

checking if var exsists

Recommended Posts

how do you check if a variable exsists in javascript?

i no in PHP you can use:

[code]isset($var)[/code]

is there something similar in javascript?

Share this post


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

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.