存在
{
"providerProperties": [
{
"key": "hotelnum",
"value": "123"
},
{
"key": "contract",
"value": "ABC"
},
{
"key": "Sequence",
"value": "1213"
},
{
"key": "lastFourDigit",
"value": "5454"
},
{
"key": "shop",
"value": "abc"
},
{
"key": "bookingEmailAddress",
"value": "abc@gmail.COM"
},
{
"key": "numOfRooms",
"value": "1"
}
}
Backbone/ChaplinJS:如何检查对象中的密钥是否存在。例如,想要检查密钥"房间数"是否可用。
您可以使用下划线方法findWhere
例如_.findWhere(yourObject.providerProperties, {key: "numOfRooms"});
如果结果不是undefined
则