I have an below array. I wanted to know how many time selectedOption key is present in array of Object. In, some object we don't have key selectedOption. So, the count of key selectedOption should return 4. How we can count these key in javascript ?
let data = [{
id: 123,
selectedOption: "ABC",
value: 345
}, {
id: 234,
selectedOption: "BCD",
value: 345
}, {
id: 356,
selectedOption: "BGY",
value: 678
}, {
id: 456,
selectedOption: "BCD",
value: 890
}, {
id: 870: value: 980
}, {
id: 385,
value: 654
}]
if (typeof ...)should do the job.