I have 2 arrays that I need to compare against each other and return the count of the same.
Example: compare array1 [abcd] against array2 [adce]. Return would be 2,1
There is a JS library UnderscoreJS which provides a number of useful method for processing JavaScript arrays. You can use its difference method:
_.difference(['a','b','c','d'], ['a','d','c','e']) // returns ["b"]