Created
May 5, 2018 05:08
-
-
Save mareku/5923be3e4730bd098594f28a4a3e6be5 to your computer and use it in GitHub Desktop.
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
// object array | |
var ary = [ | |
['aaa', 1], | |
['bbb', 2], | |
['ccc', 3], | |
['ddd', 4], | |
['eee', 5], | |
['ddd', 4], | |
['bbb', 2], | |
['aaa', 1], | |
]; | |
var values = []; | |
var no_overlapped = ary.filter(function(e) { | |
if (values.indexOf(e[0]) === -1) { | |
values.push(e[0]); | |
return e; | |
} | |
}); | |
console.log(no_overlapped); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment