I am new to Javascript. Now, Here I have an array which has multiple objects. So, I want to iterate it and if any of the object matches the condition then I want to return a value and stop that loop.
My array of obj is like,
var obj = [ { type: "", numberOfQuestions:"", technology:"" }, { type: "1", numberOfQuestions:"4", technology:"abcd" }, { type: "", numberOfQuestions:"6", technology:"ass" } ]
And my condition is,
validateData(data) {
data.High.map((object) => {
if((object.type === "") || (object.numberOfQuestions === "") || (object.technology === "")) {
return true;
} else {
return false;
}
});
}
So, what I want is that any of the object which has some keys, has empty value for any key, i.e ""
Then I want to return a true value so that I can do some other stuff.
How can I do this ?
Can anyone please help me.