problem description
for example, the background may return an object
let obj = {
school: {
class1: {
student: 50
}
}
}
I need to take out the value of student in it, but it is possible that {school: null} or {} or even undefined
is returned to me by the background.so when I take a value, it may be
let student = obj?(obj.school?(obj.school.class1?(obj.school.class1.studnet?obj.school.class1.studnet:""):""):""):"";
this is obviously not readable and troublesome. Is there any way to deal with this value gracefully
and prevent Cannot read property "xxx" of undefined from reporting errors