Loading homepage
Input: Array.from(countFrequencies([1, [2, 1, ['a', 'a']], 2])) Output: [[1, 2], [2, 2], ['a', 2]]
Input: Array.from(countFrequencies([1, ['1', false, 0], 1, null, undefined])) Output: [[1, 2], ['1', 1], [false, 1], [0, 1], [null, 1], [undefined, 1]]
Input: Array.from(countFrequencies([[], [[]]])) Output: []
countFrequencies(values) accepts one nested array and returns Map<FrequencyValue, number>. FrequencyValue is string | number | boolean | null | undefined. In TypeScript, NestedArray is a recursive read-only array interface, so mutable and frozen arrays can both be passed. The examples use Array.from(...) to display the returned Map as [value, count] pairs; the function itself must return a Map.