Created
June 2, 2011 09:10
Remove Duplicate elements from array, discover from
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Array.prototype.unique = function () { | |
var arrVal = this; | |
var uniqueArr = []; | |
for (var i = arrVal.length; i--; ) { | |
var val = arrVal[i]; | |
if ($.inArray(val, uniqueArr) === -1) { | |
uniqueArr.unshift(val); | |
} | |
} | |
return uniqueArr; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment