[Javascript] Object Not Defined

Terry Riegel riegel at clearimageonline.com
Fri Nov 11 06:45:07 CST 2011


Hello All,

I am looking for a better way for the following piece of code...

function(a){
 if(a && a.data && a.data.items){
  return a.data.items;}
 else{
  return[];
 }
}

It would be nice if this did the same thing...

function(a){return a.data.items || []};

Anyone have any thought on how this could be done I wouldn't mind wrapping it into a function if that helped. Something like this possibly...


function(a){return or(a.data.items,[]) };


Thanks for any help.

Terry


More information about the Javascript mailing list