I have an array of objects called columns
and a array of strings values called keys
I'm trying to execute some code when col.name
be !== to the value of key
columns.forEach((col, i) => {
if (col.name !== keys[i]) {
console.log('yes, I entered the if statement')
//do something here
}
});
The loop ends but no code is being executed, except the console log inside. I want to stop at first !==
, not to loop the entires values of columns
How can I do it? I read the use of every, or a simple for loop but I can't do it with an array of object.