I am running into an issue where in I have a object as below
a = {
b: {
c: 10
}
};
Now this is a dynamic object and can be empty on runtime, like this a = {}, I am trying to read c in ES6 shorthand notation like const {b: {c}} = a;. But getting error every time object is empty. Is there a way I can still use this notation for empty object, like get undefined for c in that case.
I know I can do something like (a.b ? a.b.c : undefined), but i just wanted to know shothand way of doing it.