Because this approach of checking every single object along the way is getting a bit silly:
const saved = profile &&
profile.content &&
question &&
question.subject &&
profile.content[question.subject] &&
profile.content[question.subject].saved
?
profile.content[question.subject].saved.includes(question._id)
: false
Something like this would be bless:
const value = profile.content[question.subject].saved.includes(question._id)
if(value === defined) {
// cool
}
I'm sure there's something lovely and ES6'y that older questions have missed. Cheers!