@extra-array/for-each
Version:
Calls a function for each value.
44 lines (33 loc) • 1.22 kB
Markdown
Calls a function for each value.
[:package:](https://www.npmjs.com/package/@extra-array/for-each)
[:smiley_cat:](https://github.com/orgs/nodef/packages?repo_name=extra-array)
[:running:](https://npm.runkit.com/@extra-array/for-each)
[:vhs:](https://asciinema.org/a/332053)
[:moon:](https://www.npmjs.com/package/@extra-array/for-each.min)
[:scroll:](https://unpkg.com/@extra-array/for-each/)
[:newspaper:](https://nodef.github.io/extra-array/)
[:blue_book:](https://github.com/nodef/extra-array/wiki/)
> This is part of package [extra-array].
[extra-array]: https://www.npmjs.com/package/extra-array
<br>
```javascript
array.forEach(x, fc);
// x: an array
// fc: called function (v, i, x)
```
```javascript
const array = require("extra-array");
var x = [1, 2, -3, -4];
array.forEach(x, v => console.log(v));
// 1
// 2
// -3
// -4
```
<br>
<br>
## References
- [Array.prototype.forEach: MDN web docs](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
- [array_walk: PHP](https://www.php.net/manual/en/function.array-walk.php)
- [Array.forEach: sugarjs](https://sugarjs.com/docs/#/ES5/Array/forEach)
- [foreach: @manuelstofer](https://www.npmjs.com/package/foreach)