1

let result = []
I have array const arr = ["A", "B"]
and array of array const arrOfArr = [["A","C"],["A","B"],["B","C"]]
I want find arr in arrOfArr, if exist will push "Pass" to result my code:

 arrOfArr.forEach((el) => {
        if (JSON.stringify(arr) === JSON.stringify(el)) {
          arrResult.push("Pass");
        } else {
          arrResult.push("False");
        }
      });

but If condition is not true will push many False to result
What solution for me if condition is not true just push 1 False to result?

0 Answers0