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

It so happened that I wanted to get all the elements of the first array that were not present in the second array.

Below are examples of getting the difference between two arrays using raw javascript and lodash or underscore.

Using raw javascript

Using underscore or lodash

If you are using lodash or underscore, you have a couple of alternatives.

Ryan Sukale

Ryan is just a regular guy next door trying to manage his life and finances.

Show Buttons
Hide Buttons