UNPKG

mathjs

Version:

Math.js is an extensive math library for JavaScript and Node.js. It features a flexible expression parser with support for symbolic computation, comes with a large set of built-in functions and constants, and offers an integrated solution to work with dif

45 lines (29 loc) 990 B
<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. --> # Function mode Computes the mode of a set of numbers or a list with values(numbers or characters). If there are more than one modes, it returns a list of those values. ## Syntax ```js math.mode(a, b, c, ...) math.mode(A) ``` ### Parameters Parameter | Type | Description --------- | ---- | ----------- `args` | ... * | A single matrix ### Returns Type | Description ---- | ----------- * | The mode of all values ## Examples ```js math.mode(2, 1, 4, 3, 1) // returns [1] math.mode([1, 2.7, 3.2, 4, 2.7]) // returns [2.7] math.mode(1, 4, 6, 1, 6) // returns [1, 6] math.mode('a','a','b','c') // returns ["a"] math.mode(1, 1.5, 'abc') // returns [1, 1.5, "abc"] ``` ## See also [median](median.md), [](.md), [mean](mean.md)