added docs

This commit is contained in:
didier amyot committed 2023-12-05 09:42:34 -05:00
1 parent 1dcb884552
commit 8acba51d27
17 files changed
+2213 -6

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
export class HockeyGame{
constructor(){
this.home = 0
this.away = 0
}
/**
* Call this method when home team scores. It will
* increase home team score by 1 point.
*/
homeTeamScores(){
this.home += 1;
}
/**
* Call this method when away team scores. It will
* increase home team score by 1 point.
*/
awayTeamScores(){
this.away += 1;
}
/**
* Returns winner of the game.
*
* @returns {string} the name of the winner team. Either "home", "away" or "tie"
*/
winner(){
if(this.home > this.away){
return "home"
}
if(this.away > this.home){
return "away"
}
return "tie"
}
}