Skip to content

Latest commit

 

History

History
33 lines (21 loc) · 575 Bytes

frequency.md

File metadata and controls

33 lines (21 loc) · 575 Bytes

arrays.frequency

frequency(array)

Frequency returns an object mapping each unique item in an array to the number of items it occurs in the array.

Arguments

  1. array (Array): input array

Returns

(Object): object of uniq values and their frequency of occurrence

Example

const result = arrays.frequency(['a', 'b', 'a', 'c', 'a', 'c', 'b']);
console.log(result)
> { a: 3, b: 2, c: 2 }