This question has already been answered:
- Symmetric difference 4 replies
Hello, friends, I have a function that checks the elements in the array and returns those that have passed the test. How to change the conditions so that it returns those items that did not pass the test? Simple change == to != Not working
function areIn(oldAra) { return function(elem) { var returnArr = []; for (var i = 0; i < oldAra.length; i++) { for (var j = 0; j < elem.length; j++) { if(elem[j] == oldAra[i]) { returnArr.push(elem[j]); } } } return returnArr; }; } var arr = [1, 2, 3, 4, 5, 6, 7]; var check = areIn(arr); console.log(check([2, 3, 4, 10])); //[2, 3, 4]