Retired
Who will win the dice roll (retired)
Description:
Story
Two friends decided to roll two dices and compete to see who will get the bigger amount.
Challenge
Create a function whoWin, that takes two objects p1 and p2 in which are stored the values name and diceNums (an array with two digits from 1 to 6). This function should calculate the sum of numbers from two dice of each player and determine the winner or draw.
Example
let p1 = {
"name": "Slava",
"diceNums": [6,6]
}
let p2 = {
"name": "Anthony",
"diceNums": [5,6]
}
// whoWin should return "Slava wins! He has 12 and Anthony has 11."
let p1 = {
"name": "Dylan",
"diceNums": [6,6]
}
let p2 = {
"name": "John",
"diceNums": [6,6]
}
// whoWin should return "DRAW!"
Arrays
Strings
Similar Kata:
Stats:
Created | Jul 22, 2023 |
Warriors Trained | 18 |
Total Skips | 0 |
Total Code Submissions | 51 |
Total Times Completed | 10 |
JavaScript Completions | 10 |
Total Stars | 0 |
% of votes with a positive feedback rating | 44% of 8 |
Total "Very Satisfied" Votes | 2 |
Total "Somewhat Satisfied" Votes | 3 |
Total "Not Satisfied" Votes | 3 |
Total Rank Assessments | 8 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 7 kyu |
Lowest Assessed Rank | 8 kyu |