Question: Write an object called chess that signifies a game between two opponents or teams. Add the following properties to chess, and assign any value to
Write an object called chess that signifies a game between two opponents or teams. Add the following properties to chess, and assign any value to each property:
-
winner - An object with properties name and score
-
loser - An object with properties name and score
Add the following methods to chess:
-
getMarginOfVictory() - Returns the difference between the winner's score and the loser's score
-
showSummary() - Outputs to the console the winner's name and score and the loser's name and score
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
