Possible Duplicate:
Detecting an undefined object property in JavaScript
From the below JavaScript sample,
try {
if(jsVar) {
proceed();
}
}
catch(e) {
alert(e);
}
this jsVar is declared and initialized in another file.
The problem is that code throws undefined error when this code is executed before the other file (where its declared and initialized) is executed. That is why it is surrounded by try and catch.
What's the best way to handle this undefined error than try catch?