0 added
0 removed
Original
2026-01-01
Modified
2026-03-09
1
<ul><li>script.js</li>
1
<ul><li>script.js</li>
2
</ul><p>JavaScript</p>
2
</ul><p>JavaScript</p>
3
<p>var diceNumber = 2; var firstCat = { name: 'Muffin', points: 0 }; var secondCat = { name: 'Rudolph', points: 0 }; var runGame = function (quantity, firstPlayer, secondPlayer) { firstPlayer.points += muffin.throwDice(quantity, quantity * 6); secondPlayer.points += muffin.throwDice(quantity, quantity * 6); console.log(firstPlayer.name + ' rolled ' + firstPlayer.points); console.log(secondPlayer.name + ' rolled ' + secondPlayer.points); }; runGame(diceNumber, firstCat, secondCat);</p>
3
<p>var diceNumber = 2; var firstCat = { name: 'Muffin', points: 0 }; var secondCat = { name: 'Rudolph', points: 0 }; var runGame = function (quantity, firstPlayer, secondPlayer) { firstPlayer.points += muffin.throwDice(quantity, quantity * 6); secondPlayer.points += muffin.throwDice(quantity, quantity * 6); console.log(firstPlayer.name + ' rolled ' + firstPlayer.points); console.log(secondPlayer.name + ' rolled ' + secondPlayer.points); }; runGame(diceNumber, firstCat, secondCat);</p>
4
<p>Thanks! We’ll fix everything at once!</p>
4
<p>Thanks! We’ll fix everything at once!</p>
5
<h2>Result</h2>
5
<h2>Result</h2>
6
<ol><li>Create an array cats with firstCat, secondCat elements before function runGame.</li>
6
<ol><li>Create an array cats with firstCat, secondCat elements before function runGame.</li>
7
<li>Delete parameters firstPlayer and secondPlayer in <em>declaration</em>of function runGame and instead of them add parameter players.</li>
7
<li>Delete parameters firstPlayer and secondPlayer in <em>declaration</em>of function runGame and instead of them add parameter players.</li>
8
<li>Delete arguments firstCat and secondCat in function<em>call</em>and instead of them add argument cats.</li>
8
<li>Delete arguments firstCat and secondCat in function<em>call</em>and instead of them add argument cats.</li>
9
<li>In the body of the runGame function, instead of the entire code, write a loop that increases variable i from 0 to players.length (not including this value). Value of i must increase by one after each iteration.</li>
9
<li>In the body of the runGame function, instead of the entire code, write a loop that increases variable i from 0 to players.length (not including this value). Value of i must increase by one after each iteration.</li>
10
<li>Inside the loop, log in the console the current element of the players array.</li>
10
<li>Inside the loop, log in the console the current element of the players array.</li>
11
</ol>
11
</ol>