- 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) {
console.log(muffin.throwDice(quantity, quantity * 6));
};
runGame(diceNumber, firstCatName, firstCatPoints, secondCatName, secondCatPoints);
Result
Goalscompleted
- Inside
runGame
, replace roll’s console log with increase of the points of the first playerfirstPlayerPoints += muffin.throwDice(quantity, quantity * 6);
. - Similarly, increase the second player’s points
secondPlayerPoints
. - Log points of the first player
firstPlayerName + 'rolled' + firstPlayerPoints
in the console. - Similarly, log the second player’s points.
Comments