I have this array:
var data= [{IsNormal:"true", Name:"Mike"},
{IsNormal:"true", Name:"Tom"},
{IsNormal:"false", Name:"Clause"},
{IsNormal:"true", Name:"Timm"},
{IsNormal:"true", Name:"Marta"},
{IsNormal:"true", Name:"Dora"}];
I need to write function to check if at least one of the objects in array has property IsNormal equal to false, if there is function must return false otherwise it must return true.
Here is my implementation:
function chekStatus(data) {
_.each(inspections, function (value, key) {
if (!value.IsNormal)
return false;
return true;
});
}
but I want to write something more elegant using array prototype javascript fuctions.