I have object in which if key does not exist set to null using javascript.
If the key doesnot exist in object obj like ccy does not exist cn MY and CA, how to assign and set to null using javascript.
var obj=[{
"cn": "TH",
"lang": "thai",
"bank": "yes",
"ccy": "THB"
},{
"cn": "MY",
"lang": "malay",
},{
"cn": "CA",
"lang": "english",
"bank": "yes"
}]
render(){
obj.map(e=>
return html`
<h1>${e.cn}</h1>
<h5>${e.lang}</h5>
<h6>${e.ccy}</h6>
`
)
}
${e.ccy === undefined ? null : e.ccy}objsince dynamic how to check the key name itself exist<h6>${e.ccy || null}</h6>do the trick?