Created
October 5, 2014 05:38
-
-
Save gdumitrescu/1a9db1676512a4b3adc2 to your computer and use it in GitHub Desktop.
// source http://jsbin.com/vaxavarujotu/2
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>JS Bin</title> | |
</head> | |
<body> | |
<script id="jsbin-javascript"> | |
(function IIFE() { | |
'use strict'; | |
Array.prototype.unique = function() { | |
return this.filter(function(value, index, self) { | |
return self.indexOf(value) === index; | |
}); | |
}; | |
var compareNumbers = function(a,b) { | |
return a - b; | |
}; | |
var arr = ["a","c", 1, 1, 1,"b","a",1, 2, 9]; | |
console.log(arr.unique().sort()); | |
})(); | |
</script> | |
<script id="jsbin-source-javascript" type="text/javascript">(function IIFE() { | |
'use strict'; | |
Array.prototype.unique = function() { | |
return this.filter(function(value, index, self) { | |
return self.indexOf(value) === index; | |
}); | |
}; | |
var compareNumbers = function(a,b) { | |
return a - b; | |
}; | |
var arr = ["a","c", 1, 1, 1,"b","a",1, 2, 9]; | |
console.log(arr.unique().sort()); | |
})(); | |
</script></body> | |
</html> |
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
(function IIFE() { | |
'use strict'; | |
Array.prototype.unique = function() { | |
return this.filter(function(value, index, self) { | |
return self.indexOf(value) === index; | |
}); | |
}; | |
var compareNumbers = function(a,b) { | |
return a - b; | |
}; | |
var arr = ["a","c", 1, 1, 1,"b","a",1, 2, 9]; | |
console.log(arr.unique().sort()); | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment