let arr = [1,2,3,0,4,5] let arr2=[0,2] let ans = arr.filter(function(value,index,array){ return !this.includes(value) },arr2) console.log(ans)