UNPKG

706 BMarkdownView Raw
1<!-- Note: This file is automatically generated from source code comments. Changes made in this file will be overridden. -->
2
3# Function count
4
5Count the number of elements of a matrix, array or string.
6
7
8## Syntax
9
10```js
11math.count(x)
12```
13
14### Parameters
15
16Parameter | Type | Description
17--------- | ---- | -----------
18`x` | string &#124; Array &#124; Matrix | A matrix or string
19
20### Returns
21
22Type | Description
23---- | -----------
24number | An integer with the elements in `x`.
25
26
27## Examples
28
29```js
30math.count('hello world') // returns 11
31const A = [[1, 2, 3], [4, 5, 6]]
32math.count(A) // returns 6
33math.count(math.range(1,6)) // returns 5
34```
35
36
37## See also
38
39[size](size.md)