Codington
0 of 10 problems solved • 0%

Exercise prompt

Visit Values with for...of

A for...of loop visits each array value in order.

Example

const colors = ["red", "blue"]; for (const color of colors) { console.log("Color:", color); } // Output: // Color: red // Color: blue
  • of colors selects the array to visit.
  • const color receives the current value: first "red", then "blue". Use it directly without an index.

Your task

Use for...of to visit every supplied ingredient and display three lines beginning with Ingredient:.