PHP developers will all know about the array_unique() function which removes duplicate values from an array.
Up until today, we've been using the following function to replicate this function in Javascript function array_unique(arr) { var newArray = []; var existingItems = {}; var prefix = String(Math.random() * 9e9); for (var ii = 0; ii < arr.length; ++ii) { if (!existingItems[prefix + arr[ii]]) { newArray.push(arr[ii]); existingItems[prefix + arr[ii]] = true; } } return newArray; } However, i have just come to learn that jquery's javascript utilities provide the same affect using $.merge(). So, previously, we would have done arr = array_unique(arr), jquery allows the same thing to be accomplished through $.merge(arr, arr) - the immediate benefit of which is that the above code can be deleted from our core js library. 1. Any chance that jquery will support $.unique() as it makes more sense than $.merge(arr, arr) 2. Have i missed something? 3. Any comments from anyone?