We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 84fc8f1 commit 677f1b4Copy full SHA for 677f1b4
javascript/array-methods/foreach-method.md
@@ -0,0 +1,17 @@
1
+# How to Use the ForEach Method
2
+
3
+---
4
5
+In JavaScript, the `.forEach()` method lets you execute the function you provide once for each element in a given array.
6
7
+```js
8
+const animals = ["Giraffe", "Orangutan", "Elephant"]
9
10
+animals.forEach((animal) => console.log(animal))
11
12
+// Giraffe
13
+// Orangutan
14
+// Elephant
15
+```
16
17
+[link](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/foreach)
0 commit comments