I am trying to check if a value is present inside an array of object
function hasProperties(id){
jQuery(JSON.parse(jQuery("#PropertiesField").html())).each(function () {
if(id== jQuery(this)[0].properties.id) {
console.log((id== jQuery(this)[0].properties.id));
return "Present";
}
})
};
var something = hasProperties("someid");
the above snippet returns undefined for something, but also true is logged in console. why is it not returning present when condition satisfies, what is the mistake that I have done?