Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started