Interactive online courses HTML Academy
2026-03-09 14:10 Diff
  • script.js

JavaScript

var diceNumber = 2; var firstCat = { name: 'Muffin', points: 0 }; var secondCat = { name: 'Rudolph', points: 0 }; var cats = [firstCat, secondCat]; var runGame = function (quantity, players) { for (var i = 0; i < players.length; i++) { var throwResult = muffin.throwDice(quantity, quantity * 6); players[i].points += throwResult; console.log(players[i].name + ' rolled ' + players[i].points); } }; runGame(diceNumber, cats);

Thanks! We’ll fix everything at once!

Result

  1. Log in the console array cats immediately before and immediately after calling the runGame function.
  2. After the loop, return player array players from the runGame function.
  3. Instead of the usual call of runGame, record the result of the function’s operation in variable cats.
  4. Delete the first log of cats in the console.