Project: Priya's Game Night Page

Priya’s page has come a long way. Its date line and its “Who’s Coming” list are built by main.js, and in the last exercise you drew a snacks list the same way. The part Priya started with, this month’s games, is still empty. The summary line in the header is empty too.

In this project, you’ll finish Priya’s page on your own. You’ll give the script this month’s games as data, then have it build the games list, mark the long games, and fill the header’s summary line. You’ll check each part in the browser. You’ve met every piece in the lessons. What’s new is putting them together without a script to follow. Start with what Priya has asked for.

Read Priya’s Brief

Priya picks a new set of games every month, and she doesn’t want to edit the HTML each time. Her plan is to change one array in main.js and have the page follow. This month, she’s bringing five games:

Game Players Minutes
Catan 3-4 90
Ticket to Ride 2-5 60
Codenames 4-8 15
Carcassonne 2-5 45
Azul 2-4 40

You can check each part of the finished page by looking at it:

  • The games list has one item per game, in the array’s order. Each item reads like this one, with a plain hyphen between the player counts: Catan: 3-4 players, 90 minutes.
  • Long games stand out. Every game over 60 minutes gets the class long, so the #games li.long rule shows it in the accent color and bold. This month, that’s only Catan. Ticket to Ride takes exactly 60 minutes, which isn’t over 60, so it stays gray.
  • The summary line in the header counts the games and gives the longest game’s duration in minutes: 5 games, longest 90 minutes.

One more requirement makes this a script’s job. Nothing about this month’s games is typed into index.html. Add a game to the array, save, and the list, the highlighting for long games, and the summary all change with it.

Locked learning resources

Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Locked learning resources

The full lesson is for members only. Join us and get access to thousands of tutorials and a community of expert JavaScript developers.

Unlock This Lesson

Already a member? Sign-In

Become a Member to join the conversation.