1var array3 = array1.filter(function(obj) { return array2.indexOf(obj) == -1; });
1let array = [1,2,3,4,5,6,78,9];
2
3function except(array,excluded){
4let newArr,temp,temp1;
5
6 check1=array.filter(function(value)
7 {
8 return excluded.indexOf(value) == -1;
9
10 });
11
12 check2=excluded.filter(function(value)
13 {
14 return array.indexOf(value) == -1;
15
16 });
17
18 output=check1.concat(check2);
19
20
21 return output;
22
23 }
24
25
26except(array,[1,2])
27
28//so the output would be => [ 3, 4, 5, 6, 78, 9 ]