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

Improve the printWinners function:

  1. After logging 'All cats rock!', end the function with return.
  2. After the first condition, create variable message, which contains the line 'The winner is '.
  3. After the variable, write the for loop, which increases the counter i from 0 to the length of the array winners (not including this value) by one at each iteration.
  4. In the body of the loop, add the names of the winners message += winners[i].name.
  5. After the loop, use += to add the ' with the number of points: ' + points of the first player in the winners array string to the message.
  6. Log message in the console.