The Leader

Who's leading the league? The leader is the team with the most points. Below the table, print its name, and then an array of the names of the teams that haven't lost a match yet, in the order of the table:

Lions: 10
Eagles: 8
Sharks: 4
Wolves: 0
Leader: Lions
Unbeaten: ["Lions", "Eagles"]

When every team has lost at least once, the program prints Unbeaten: [].

A tip: finding the leader is the largest value from the lesson on loops, only with objects: keep the whole team, and compare the points.

Instructions

Print the leader of the league.

Below it, print the unbeaten teams.

Start programming for free

By signing up, you agree to the Terms of Service and Privacy Policy.

Or sign up with:

2/3