Array forEach in JavaScript
Level 387 keystrokes
This iterates over an array using forEach and outputs each color.
JavaScript code
// Create an array of color strings1let colors = ["red", "green", "blue"];// forEach calls a function for each element// The function receives the current element as parameter2colors.forEach(function(c) { // c is "red", then "green", then "blue"3 console.log(c);4});Output
red green blue
Practice typing this code. Results are not recorded in the rankings.
Symbols in this code
The symbols you type in this JavaScript code and how often they appear.
"× 6;× 3(× 3)× 3,× 2.× 2[× 1]× 1{× 1}× 1