@extra-array/slice-update
Version:
Gets a part of array.
57 lines (41 loc) • 1.37 kB
Markdown
Gets a part of array.
[:package:](https://www.npmjs.com/package/@extra-array/slice-update)
[:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-array)
[:running:](https://npm.runkit.com/@extra-array/slice-update)
[:vhs:](https://asciinema.org/a/332130)
[:moon:](https://www.npmjs.com/package/@extra-array/slice-update.min)
[:scroll:](https://unpkg.com/@extra-array/slice-update/)
[:newspaper:](https://nodef.github.io/extra-array/)
[:blue_book:](https://github.com/nodef/extra-array/wiki/)
> Alternatives: [slice], [slice$].
> This is part of package [extra-array].
[extra-array]: https://www.npmjs.com/package/extra-array
<br>
```javascript
array.slice$(x, [i], [I]);
// x: an array (updated)
// i: start index (0)
// I: end index (X)
// → x
```
```javascript
const array = require("extra-array");
var x = [1, 2, 3, 4, 5];
array.slice$(x, 2);
// [ 3, 4, 5 ]
x;
// [ 3, 4, 5 ]
var x = [1, 2, 3, 4, 5];
array.slice$(x, 2, 4);
// [ 3, 4 ]
var x = [1, 2, 3, 4, 5];
array.slice$(x, -3, -1);
// [ 3, 4 ]
```
<br>
<br>
## References
- [Array.prototype.slice: MDN web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/slice)
- [_.slice: lodash](https://lodash.com/docs/4.17.15#slice)
[slice]: https://github.com/nodef/extra-array/wiki/slice
[slice$]: https://github.com/nodef/extra-array/wiki/slice$