In ruby we something like a.try(:property)
even if a is nil(undefined) program won't throw an exception and keep going. But for nodejs/javascript if I have a.property
and a is undefined program will throw an exception. I have to do something like
if (a) {
a.property
}
It is quite tedious and unpretty.
Is there something in nodejs similar like a.try(:property)
so I don't have to check before I use a property?