0

I'm doing a check inside a forEach() because there are x rows inside the output it shows me x times the error. Lets pretent var compare outputs 1,2,3,4

compare.forEach(function(item){
 if(input == item){
   console.log('Succes');
 } else {
  // So if input does not equals the arrays
  console.log('error');
 }
});

Now because i have 4 items in the output i get 4 times the console.log('error'); how must I avoid the 4 times error show ?

Inna
  • 423
  • 1
  • 4
  • 13

0 Answers0