[英]Check if the value of an object property is an object
const opb = { 'e' : 1, '3' : 2, '4' : {'ee':12} } Object.entries(opb).forEach(el => {console.log(el[1] !== typeof 'object' , typeof el[1])})
Hello im building a check that checks if the first value of an object property is another object.你好,我正在构建一个检查,检查对象属性的第一个值是否是另一个对象。
I am doing this as follow:我这样做如下:
const opb = { 'e' : 1, '3' : 2, '4' : {'ee':12} } Object.entries(opb).forEach(el => {console.log(el[1] !== typeof 'object' , el[1])})
Somehow everything returns true, eventho one should be an object (false).不知何故,一切都返回真,万一应该是一个对象(假)。
It should be typeof el[1] !== 'object'
.它应该是
typeof el[1] !== 'object'
。
const opb = { 'e' : 1, '3' : 2, '4' : {'ee':12} } Object.entries(opb).forEach(el => {console.log(typeof el[1] !== 'object' , el[1])})
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.