DEV Community

loading...

Discussion on: 😲🤯The most outstanding new feature in Javascript you need to know about: Optional Chaining

Collapse
devinrhode2 profile image
Devin Rhode

actually that lodash _.get methods looks pretty good.. could also have extra functionality to tell you which property was undefined, to help with debugging

and that lodash method COULD be added to the Object.prototype... so you COULD do..

person.lookup('details.name.fullName')

Maybe person is defined but is missing the details object. Maybe there's no fullName property. An actual function call could tell you these things in a very elegant want.