I am a beginner in javascript and I have a question. This array represents the "dataState" in the forloop. But somehow I cannot access the id with "item.id" and so the first condition never triggers and in the else case, the item.id pops out as undefined. Any idea?
[ { "name": "a", "secName": "b", "tel": "+ 123 737 159 028", "note": "qw", "id": "B_A" } ]
for(const item in dataState){
console.log(item)
if(item.id===state.secName.toUpperCase() + "_" + state.name.toUpperCase()){
setId("11")
console.log("green")
}else{
setId(state.id)
console.log(item.id)
console.log(dataState)
console.log("red")
}
}