@extra-array/size
Version:
Counts the number of values.
53 lines (38 loc) • 1.46 kB
Markdown
Counts the number of values.
[:package:](https://www.npmjs.com/package/@extra-array/size)
[:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-array)
[:running:](https://npm.runkit.com/@extra-array/size)
[:vhs:](https://asciinema.org/a/332129)
[:moon:](https://www.npmjs.com/package/@extra-array/size.min)
[:scroll:](https://unpkg.com/@extra-array/size/)
[:newspaper:](https://nodef.github.io/extra-array/)
[:blue_book:](https://github.com/nodef/extra-array/wiki/)
> Similar: [index], [indexRange], [size], [isEmpty].
> This is part of package [extra-array].
[extra-array]: https://www.npmjs.com/package/extra-array
<br>
```javascript
array.size(x, [i], [I]);
// x: an array
// i: start index (-ve: from right) (0)
// I: end index (-ve: from right) (X)
```
```javascript
const array = require("extra-array");
var x = [2, 4, 6, 8];
array.size(x);
// 4
array.size(x, 1);
// 3
array.size(x, 1, 3);
// 2
```
<br>
<br>
## References
- [Array.prototype.slice: MDN web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice)
- [Array.length: MDN web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/length)
[index]: https://github.com/nodef/extra-array/wiki/index
[indexRange]: https://github.com/nodef/extra-array/wiki/indexRange
[size]: https://github.com/nodef/extra-array/wiki/size
[isEmpty]: https://github.com/nodef/extra-array/wiki/isEmpty