简体   繁体   English

Node.js 显示类型错误:无法读取未定义的属性

[英]Node.js showing TypeError: Cannot read properties of undefined

RV =(typeof (myresult.CDF.UTILITYTYPE.D2.INSTPARAM[0].VALUE !== 'undefined')) ? myresult.CDF.UTILITYTYPE.D2.INSTPARAM[0].VALUE : 'NA';
                                                             

in the above code i want to get the value, if the key does not exists it should take 'NA' but iam getting below error在上面的代码中,我想获取值,如果密钥不存在,它应该采用“NA”,但我遇到了以下错误

Error : - TypeError: Cannot read properties of undefined (reading 'INSTPARAM')错误:- TypeError:无法读取未定义的属性(读取“INSTPARAM”)

myresult.CDF.UTILITYTYPE.D2?.INSTPARAM[0].VALUE??我的结果.CDF.UTILITYTYPE.D2?.INSTPARAM[0].VALUE?? 'NA'; '不适用';

using the option chaining.使用选项链。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Node.js passport.use() function: TypeError: Cannot read properties of undefined (reading 'use') - Node.js passport.use() function: TypeError: Cannot read properties of undefined (reading 'use') Node.JS IPFS 发送消息 TypeError: Cannot read properties of undefined (reading 'publish') - Node.JS IPFS sending message TypeError: Cannot read properties of undefined (reading 'publish') Express ( node.js ) - 类型错误:无法读取 null 的属性 - Express ( node.js ) - TypeError: Cannot read properties of null Node.js TypeError:无法读取未定义的属性“主机” - Node.js TypeError: Cannot read property 'host' of undefined 类型错误:无法读取未定义的 Node.js 的属性 - TypeError: Cannot read property of undefined Node.js Node.js-TypeError:无法读取未定义的属性“ document” - Node.js - TypeError: Cannot read property 'document' of undefined Node.js中的TypeError:无法读取未定义的属性“ 0” - TypeError in node.js: cannot read property '0' of undefined 未捕获的类型错误:无法读取 node.js 中未定义的属性“通道” - Uncaught TypeError: Cannot read property 'channel' of undefined in node.js Node.js 抛出 TypeError:无法读取未定义的属性“testModule” - Node.js throwing TypeError: Cannot read property 'testModule' of undefined TypeError:无法读取未定义的属性“ get”(Node.js) - TypeError: Cannot read property 'get' of undefined (Node.js)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM