1 | Counts the number of values.
|
2 | [:package:](https://www.npmjs.com/package/@extra-array/length)
|
3 | [:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-array)
|
4 | [:running:](https://npm.runkit.com/@extra-array/length)
|
5 | [:vhs:](https://asciinema.org/a/332092)
|
6 | [:moon:](https://www.npmjs.com/package/@extra-array/length.min)
|
7 | [:scroll:](https://unpkg.com/@extra-array/length/)
|
8 | [:newspaper:](https://nodef.github.io/extra-array/)
|
9 | [:blue_book:](https://github.com/nodef/extra-array/wiki/)
|
10 |
|
11 | > Similar: [index], [indexRange], [size], [isEmpty].
|
12 |
|
13 | > This is part of package [extra-array].
|
14 |
|
15 | [extra-array]: https://www.npmjs.com/package/extra-array
|
16 |
|
17 | <br>
|
18 |
|
19 | ```javascript
|
20 | array.length(x, [i], [I]);
|
21 | // x: an array
|
22 | // i: start index (-ve: from right) (0)
|
23 | // I: end index (-ve: from right) (X)
|
24 | ```
|
25 |
|
26 | ```javascript
|
27 | const array = require("extra-array");
|
28 |
|
29 | var x = [2, 4, 6, 8];
|
30 | array.length(x);
|
31 | // 4
|
32 |
|
33 | array.length(x, 1);
|
34 | // 3
|
35 |
|
36 | array.length(x, 1, 3);
|
37 | // 2
|
38 | ```
|
39 |
|
40 | <br>
|
41 | <br>
|
42 |
|
43 |
|
44 | ## References
|
45 |
|
46 | - [Array.prototype.slice: MDN web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice)
|
47 | - [Array.length: MDN web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/length)
|
48 |
|
49 | [index]: https://github.com/nodef/extra-array/wiki/index
|
50 | [indexRange]: https://github.com/nodef/extra-array/wiki/indexRange
|
51 | [size]: https://github.com/nodef/extra-array/wiki/size
|
52 | [isEmpty]: https://github.com/nodef/extra-array/wiki/isEmpty
|