DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
SCRIPT & CODE EXAMPLE
CODE EXAMPLE FOR JAVASCRIPT
counting duplicate values javascript
var
counts
=
{
}
;
your_array
.
forEach
(
function
(
x
)
{
counts
[
x
]
=
(
counts
[
x
]
||
0
)
+
1
;
}
)
;
Source by flaviocopes.com #
PREVIOUS
NEXT
Tagged:
#counting
#duplicate
#values
#javascript
ADD COMMENT
Topic
COMMENT
Name
9+9 =
Submit