I have an array:
var a = [2,3,4,5,5,4]
I want to get unique array out of given array like
b = [2,3,4,5]
I have tried
a.filter(function(d){return b.indexOf(d)>-1})
and I don't want to use for loop.
I have an array:
I want to get unique array out of given array like
I have tried
and I don't want to use for loop. |
|||||||||||||
|
you can simply do it in java script , with the help of filter second parameter which is for indexing like this
|
|||||||||||||
|
This is not an Angular related problem. It can be resolved in a couple of ways depending which libraries you are using. If you are using jquery:
The output would be:
If you are using underscore:
Same output. And pure JS code:
|
|||
|
|
|||||
|