Show Buttons
Share On Facebook
Share On Twitter
Share On Google Plus
Share On Linkdin
Share On Reddit
Share On Stumbleupon
Contact us
Hide Buttons

Remove the elements of one array from another using underscore or raw javascript

It so hap­pened that I wanted to get all the ele­ments of the first array that were not present in the sec­ond array.

Below are exam­ples of get­ting the dif­fer­ence between two arrays using raw javascript and lodash or underscore.

Using raw javascript

Using under­score or lodash

If you are using lodash or under­score, you have a cou­ple of alternatives.