How to get the difference between two arrays in JavaScript?
This answer was written in 2009, so it is a bit outdated, also it’s rather educational for understanding the problem. Best solution I’d use today would be (credits to other author here) I assume you are comparing a normal array. If not, you need to change the for loop to a for .. in loop.