Categories




PreviousNext
How to check a variable defined or not using javascript    
 Send mail Views:174
Belongs to : Javascript
Facebook Bookmarkbookmark this page Digg Bookmark Delicious BookmarkStumbleupon Bookmarkshare with orkut Post to Google Buzz

We can check whether a variable is defined or not in a javascript program


for example take the below ex:

//This part of program is optional
var hi=1;
var page='http://hiox.org';


//This part of program we are going to check whether the variable is declared or not

try{
if(hi){//This line will be execute if variable "hi" defined previously
}
}
catch(err){// If the variable not defined the program will come to this part
var hi=10;
}



I feel its very useful.


Pictures and Videos
Online Calculators
embed code


By - Vinoth, On - 2010-06-05
Send This
PreviousNext

User Comments


Add NEW Feedback:

Name :     Email :

 Server Monitoring Web hosting by Hiox India Privacy Policy Terms and Conditions