Lists all possible prefixes.
[:package:](https://www.npmjs.com/package/@extra-array/prefixes)
[:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-array)
[:running:](https://npm.runkit.com/@extra-array/prefixes)
[:vhs:](https://asciinema.org/a/332110)
[:moon:](https://www.npmjs.com/package/@extra-array/prefixes.min)
[:scroll:](https://unpkg.com/@extra-array/prefixes/)
[:newspaper:](https://nodef.github.io/extra-array/)
[:blue_book:](https://github.com/nodef/extra-array/wiki/)

> Similar: [prefix], [prefixes], [hasPrefix].

> This is part of package [extra-array].

[extra-array]: https://www.npmjs.com/package/extra-array

<br>

```javascript
array.prefixes(x, [n]);
// x: an array
// n: number of values (-1 => any)
```

```javascript
const array = require("extra-array");

[...array.prefixes([1, 2])];
// [ [], [ 1 ], [ 1, 2 ] ]

[...array.prefixes([1, 2, 3])];
// [ [], [ 1 ], [ 1, 2 ], [ 1, 2, 3 ] ]
```

<br>
<br>


## References

- [Data.List.inits: Haskell](https://hackage.haskell.org/package/base-4.12.0.0/docs/Data-List.html#v:inits)

[prefix]: https://github.com/nodef/extra-array/wiki/prefix
[prefixes]: https://github.com/nodef/extra-array/wiki/prefixes
[hasPrefix]: https://github.com/nodef/extra-array/wiki/hasPrefix
