Currently I am (in many places in a project) checking to see if data exists at one object's root level, just to see if the next level exists, just to see the next and so on.
This might look something like this:
let name = display.data ? display.data ? data.name.bio ? data.name.bio.details ? :"Name N/A" : "Name N/A" : "Name N/A" : "Name N/A"
Instead of checking it this way, is there a way to make a call directly to data.name.bio.details that doesn't throw an error but silently falls back to being undefined?
E.g. if I call data.name.bio.details and data.name.bio doesn't exist, I'll get an error saying that and it's not so silent.
Could I do something like this, that wouldn't scream bloody murder when .bio doesn't exist?:
var name = data.name.bio.details || "Name N/A"
Hope this makes sense, not sure if there's a better approach!
 
     
     
     
    