Last active
December 4, 2018 14:12
-
-
Save MAKIO135/f26bb403aa5cc81bcf5b72caae1b2282 to your computer and use it in GitHub Desktop.
JS snippet to get the number of occurence in an array
This file contains hidden or 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
Array.prototype.count = function( n ) { | |
return this.filter( d => d === n ).length; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment