JavaScript中是否有范例或实用程序方法,可让您解析对象属性链
archive[5].school['sir edward high school'].faculties[2].name
然后安全地评估name
的值,而不必验证过程的每一步
if(archive[5] && archive[5].school['sir edward high school'] && archive[5].school['sir edward high school'].faculties[2] && archive[5].school['sir edward high school'].faculties[2].name == 'Henry') {
...
}