- script.js
JavaScript
let diceNumber = 2;
let firstCat = {
name: 'Cupcake',
points: 0
};
let secondCat = {
name: 'Rodolfo',
points: 0
};
let firstCatName = 'Cupcake';
let firstCatPoints = 0;
let secondCatName = 'Rodolfo';
let secondCatPoints = 0;
let runGame = function (quantity, firstPlayerName, firstPlayerPoints, secondPlayerName, secondPlayerPoints) {
firstPlayerPoints += keks.throwDice(quantity, quantity * 6);
secondPlayerPoints += keks.throwDice(quantity, quantity * 6);
console.log(firstPlayerName + ' sacó ' + firstPlayerPoints);
console.log(secondPlayerName + ' sacó ' + secondPlayerPoints);
};
runGame(diceNumber, firstCatName, firstCatPoints, secondCatName, secondCatPoints);
Resultado de la ejecución
ObjetivosRealizado
0
- En la declaración de
runGame, elimina todos los parámetros exceptoquantityy agregafirstPlayerysecondPlayer. - En la llamada a
runGame, elimina todos los argumentos exceptodiceNumbery agregafirstCatysecondCat. - En el cuerpo de la función, reemplaza
firstPlayerPointsporfirstPlayer.pointsyfirstPlayerNameporfirstPlayer.name. - Haz los mismos cambios para usar el objeto del segundo participante.
- Elimina las variables
firstCatName,firstCatPoints,secondCatNameysecondCatPoints.