I have a method findResult
function findResult(response){
if (response[0].firstProperty.Value > 0)
return true;
else false;
}
In this method, if response object is undefined we get a javascript error. My question is whether to use explicit undefined checks or wrap the code around try/catch as shown below:
function findResult(response){
try{
if (response[0].firstProperty.Value > 0)
return true;
else return false;
}
catch(e){
return false;
}
}