Skip to content

Instantly share code, notes, and snippets.

@MAKIO135
Last active December 4, 2018 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MAKIO135/f26bb403aa5cc81bcf5b72caae1b2282 to your computer and use it in GitHub Desktop.
Save MAKIO135/f26bb403aa5cc81bcf5b72caae1b2282 to your computer and use it in GitHub Desktop.
JS snippet to get the number of occurence in an array
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