mirror of
https://github.com/josdejong/mathjs.git
synced 2026-01-25 15:07:57 +00:00
1.2 KiB
1.2 KiB
| layout |
|---|
| default |
Function count #
Count the number of elements of a matrix, array or string.
Syntax #
math.count(x)
Parameters #
| Parameter | Type | Description |
|---|---|---|
x |
string | Array | Matrix | A matrix or string |
Returns #
| Type | Description |
|---|---|
| number | An integer with the elements in x. |
Throws #
| Type | Description |
|---|
Examples #
math.count('hello world') // returns 11
const A = [[1, 2, 3], [4, 5, 6]]
math.count(A) // returns 6
math.count(math.range(1,6)) // returns 5