I have the following 2D array
var items = [['al','bv','sd'],
['al','cc','ab'],
['cv','vv','sw'],
['al','bv','sd']
];
I need a function which will return me a similar array but with distinct values. For example, in the above array, ['al','bv','sd'] happens twice.
I would like the function to return me:
var items = [['al','bv','sd'],
['al','cc','ab'],
['cv','vv','sw']
];
You have to loop two (or three times):
Loop again, through all “rows”, from beginning to the end
Loop through all “columns”:
.splicemethod.Demo: http://jsfiddle.net/EuEHc/
Code: