Interactive online courses HTML Academy
2026-03-09 14:06 Diff

In the body of the printWinners function:

  1. After declaring the variable message, add a check to make sure that the number of winners is greater than 1.
  2. If the condition is true, override the value of the variable message to 'The winners are '.
  3. At the beginning of the loop body, add a check to make sure that i is greater than or equal to 1.
  4. If the condition is met, add ', ' string to message (that way a comma will be added between all the names if there are more than one).
  5. Remove console log for arrays cats and tops at the end of the program.