Possible Duplicate:
What is the fastest or most elegant way to compute a set difference using Javascript arrays?
I need help with devising a function that will return the difference between two arrays of strings in Javascript (jQuery is acceptable as well).
I am basically looking for a function that calculates array A minus B.
So if we have the followin"
A = ['Istanbul', 'Hong Kong', 'Berlin']; B = ['Berlin', 'Bonn'];
Calling diff = minus(A,B)
should result with diff
being populated with the following values ['Istanbul', 'Hong Kong']
I do not want to use an additional library like JS Set
.
Please help with suggestions ...