scrimba
Learn JavaScript loops and iteration
forEach: traversing through an array
Go Pro!Bootcamp

Bootcamp

Study group

Collaborate with peers in your dedicated #study-group channel.

Code reviews

Submit projects for review using the /review command in your #code-reviews channel

forEach: traversing through an array
AboutCommentsNotes
forEach: traversing through an array
Expand for more info
index.js
run
preview
console
/* Example: foreach loops */
let clothes = ["top", "dirty underwear", "bottoms", "shoes", "socks"]
Console
"0"
,
"top"
,
"New array is: top,bottoms,shoes,socks,underwear"
,
"1"
,
"dirty underwear"
,
"2"
,
"shoes"
,
"3"
,
"socks"
,
"4"
,
"underwear"
,
"Clothes to wash: dirty underwear"
,
/index.html
-2:21