So I've got an object containing multiple objects, like this:
let data = {
hello: {
melon: {
yes: true
}
}
}
Here I want to check if "yes" is equal to true. The problem being that the "data" object could contain nothing, and the "hello" object could contain nothing, and it goes on. Here's what I did:
if(data.hello && && data.hello.melon && data.hello.melon.yes && data.hello.melon.yes === true){...}
Is there a way to make this condition cleaner?