Skip to content

Instantly share code, notes, and snippets.



Last active Dec 11, 2015
What would you like to do?
Making a unique javascript array using JQuery
if Array.prototype.unique == undefined
Array.prototype.unique = ->
filtered_array = []
$.each this.sort(), (index, value)->
filtered_array.push(value) if filtered_array.indexOf(value) == -1
if Array.prototype.is_unique == undefined
Array.prototype.is_unique = ->
this.length == this.unique.length
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.