You can loop through the array and check if it has the required key. Object.keysgives you an array of property names on which you can useArray.indexOf
arr.forEach(function(obj){
var prop_name = "id"
if(Object.keys(obj).indexOf(prop_name) > -1)
alert("Property present!");
else
alert("Property is missing!!");
});
source
share