Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Array.prototype.unique = function() {
- var uniqueKeys = {};
- var items = this.length;
- while ( items ) {
- uniqueKeys[ this[ --items ] ] = true;
- }
- var uniqueArray = [];
- for ( var key in uniqueKeys ) {
- if ( uniqueKeys.hasOwnProperty( key ) ) {
- continue;
- }
- uniqueArray.push( key );
- }
- return uniqueArray;
- }
Add Comment
Please, Sign In to add comment