Iterating Over Arrays
A common thing to do with arrays is to iterate over each of the values of an array individually. There are two ways to do so: 1. A for()
loop.
Output:
A
forEach()
loop.We can simplify the code above using an arrow function!
Our output is the same for all three actually.
Now that you're comfortable with the basics of arrays, we'll move on to array methods.
Last updated