Calculate the mode of an iterable. Strict equality (===) is used to compare elements.
===
Time complexity: O(n)
Space complexity: O(n)
Values to use in the calculation
An array of the modes of values
values
Math
const values = [1, 2, 2, 3, 3];mode(values); // [2, 3] Copy
const values = [1, 2, 2, 3, 3];mode(values); // [2, 3]
Calculate the mode of an iterable. Strict equality (
===
) is used to compare elements.Time complexity: O(n)
Space complexity: O(n)