JSFiddle - React, Tailwind, and code Playground
by MichaelSel
JavaScript
var arrA=[12,54,76,98,45];
var arrB=[12,98];
//Run a loop to go through all elements in arrB
for (var i=0;i<arrB.length;i++) {
//keep position of element i in arrA
//if it's not there index will be equal to -1
var index=arrA.indexOf(arrB[i])
//if it is there
if(index!=-1) {
//remove 1 element at position index from arrA
arrA.splice(index,1)
}
}
document.write(arrA)