The forEach method seems confusing to some folks, and this is normal — computers evaluate data differently than humans.

Use this color-coded breakdown to read yours so it makes sense to your inefficient human mind.

Color order: Green > Red > Grey > Yellow

  • 🟢 Green — For Each
  • 🔴 Red — item
  • Grey — in this array
  • 🟡 Yellow — do the following
forEach color coded: Green = For Each, Red = item, Grey = in this array, Yellow = do the following

Read it out loud: "For each cardData in initialCards, do the following..."

Your brain wants subject-verb-object. forEach hands you the verb first. Once you see the color order, you can't unsee it.


This works for any forEach — swap out the variable names and the pattern holds. Same colors, same order, every time.