2
我有JS对象,在Chrome的控制台看起来folllow:正确可以访问嵌套对象中的JavaScript
data: Object
comparisonType: "IN"
dateValue: ""
numericalValue: 0
screeningCriterionId: "-4"
screeningField.displayName: "Prop1"
screeningField.fieldName: "Prop2"
screeningField.groupName: "Prop3"
screeningField.type: "MULTI"
value: null
,我需要阅读screeningField.displayName: "Prop1"
从此对象,但 试图执行中控制台这myObject.screeningField.displayName
我得到的错误:
TypeError: Cannot read property 'displayName' of undefined
如何解决我的问题?
如果这确实是你在控制台中看到的,那么显然该点实际上是列入重点名称:尽量'myObject的[ 'screeningField.displayName']' – lanzz
这看起来不像JavaScript。你用来初始化对象的JavaScript代码是什么? @lanzz:不正确,错误说'screeningField'是'undefined'。 – Cerbrus
是的,你好吧,它的作品。谢谢 –