I have an object:
let someObject = {
someKey: {
otherKey: {
key3: {
youGetThePoint: null
}
}
}
};
If I write:
if (someObject.someKey.otherKey.key3.youGetThePoint) {
doStuff();
}
and some method removes key3
from the object in otherKey
then this conditional breaks.
Is there a way to write this conditional without linking several &&
together or nesting several conditionals to check each layer?
i.e. avoiding:
if (someObject && someObject.someKey && some...