I have the following
var a = [4,6,12];
var b = [4,6];
for (var i = 0; i < a.length; i++) {
for (var j = 0; j < b.length; j++) {
if (a[i] !== b[j]) {
a.pop();
}
}
}
I want to compare the two and remove 12 from a if it is not found in b. I do not want to create a new array with the result just remove from a.
However, if I console log a I get a as empty.