check if variable is defined javascript

Smith
Smith
None
2568 Points
74 Posts

Hi,

I am try like this: 

if (Titlemain != undefined)
{
//some code
}

But not working please help..

Views: 9005
Total Answered: 1
Total Marked As Answer: 0
Posted On: 04-Jul-2015 05:46

Share:   fb twitter linkedin
Answers
Rahul Maurya
Rahul M...
Teacher
4822 Points
23 Posts
         

 

Use this:

if (typeof Titlemain !== undefined)
{
     //some code
}
Posted On: 05-Jul-2015 05:12
 Log In to Chat