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

JavaScript

var diceNumber = 2; var firstCatName = 'Muffin'; var firstCatPoints = 0; var secondCatName = 'Rudolph'; var secondCatPoints = 0; var runGame = function (quantity, firstPlayerName, firstPlayerPoints, secondPlayerName, secondPlayerPoints) { firstPlayerPoints += muffin.throwDice(quantity, quantity * 6); secondPlayerPoints += muffin.throwDice(quantity, quantity * 6); console.log(firstPlayerName + ' rolled ' + firstPlayerPoints); console.log(secondPlayerName + ' rolled ' + secondPlayerPoints); }; runGame(diceNumber, firstCatName, firstCatPoints, secondCatName, secondCatPoints);

Thanks! We’ll fix everything at once!

Result

  1. Before the runGame function, add the first player object firstCat.
  2. Add the property with the player’s name: key name, value 'Muffin' to object firstCat.
  3. After the firstCat object, add the secondCat object with the name 'Rudolph'.
  4. Add to each object a property for storing the points: key points, value 0.