What would be the easiest way to check for undefined, NuLL and "" in this case:
I am receiving an object that can have and of those three states, and it comes in form of:
images[0].url
Images might not exists at all Images might have url property of null Images might have property of ""
I was using if(images[0]), but it covers only existence of [0], not deeper. How can I solve this, without switch statement.
I tried something like this:
if((object.images[0]) || (object.images[0].url)){
} else {
}
But if the [0] exists and url does not, then I get this. Uncaught TypeError: Cannot read property 'url' of undefined