I have two arrays:
var array1 = [a,b,c,d];
var array2 = [1,2,a,b];
I need to have a function that returns an array of the items not in the second Array.
var notInSecond = [c,d];
Does anyone know how to do this?
Thanks.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Keep in mind that
indexOffor arrays isn’t available for IE8 and lower and it must be emulated. I’m also assuming thatarray1doesn’t contain duplicates.