JavaScript: removing duplicated elements in an array without sorting them.
r_d(the_array)
It's recommended to use the latest remove_duplicate_shorter.js
That version won't change the original order of the array elements.
var array = [1, 2, 3, 4, "doo", "dee", "doo", "♪", "doo"],
trimmed = r_d(array);
// *trimmed* variable output will be an array.
// It consists of [1, 2, 3, 4, "doo, "dee", "♪"]
The "remove_duplicate_obj.js"
version will return the sorted array.
It will also return an array without the duplications.
The 1st version (longer snippet) was the initial tinkering. It has the same output as the "shorter"
version but has longer lines of code.
-
Kinda an explanation on Monkey Raptor.
-
Python equivalency post on Monkey Raptor.