I basically want to do
var a = b.c.d || null
but the issue is, a
might be undefined
, b
might be, or c
might be
so short of ugly try{} catch{}
or if
statements what is the best way to do this? this is for constructing a quite large object (say 50 odd properties) from a 3rd party data source