Essential JavaScript

Team Scores Kata

You are responsible for programming the scoreboard for your local sandball team.

In sandball, each team has two players, and each player has their own score. At the end of the game, the team with the highest combined score wins the game.

Your scoreboard is aware of all four scores:

Home Team Away Team
home1 away1
home2 away2

Each score will be an integer representing the number of points earned by that player.

Write a function that returns "home" if the home team won the game, "away" if the away team won the game, and "tie" if each team's combined score is the same.

Code Editor