Loading video player…

Data Drives the Page (Overview)

Welcome to Data Drives the Page. Priya hosts a board game night. Her page keeps its guest list in an array, but who’s arrived lives on the page, and the arrival count drifts. This course makes the data the one truth.

You’ll build Priya a scorekeeper for her game. Wei scores in round 1 and takes the lead. In round 2, Amara scores twice and goes ahead. Undo last round takes round 2 back, so Wei leads again. Remove Wei, and with the other three tied at 0, nobody leads.

Each click changes only the data. Your code then draws the page again from it, so the totals always match the scores.

What You’ll Learn

Here’s what each part of the course has you do:

  • Keeping Lists in Arrays: You line up tonight’s games in arrays.
  • Handling a Whole List: You cover a whole list with one listener, even rows added later.
  • Drawing the Page From Data: You make the guest records the one truth that the page is drawn from.
  • Splitting the App Into Modules: You split the code into modules.
  • Project: Priya’s Score Keeper: You build the scorekeeper.

By the end of this course, you’ll be able to keep an app’s data in one place and redraw the page from it, with one listener handling a whole list, and split the app into modules.

Before You Start

You should know JavaScript basics, such as arrays, objects, and functions. You should also know how to find and create elements, listen for clicks, and change classes and data attributes.

You’ll use a current version of Chrome or Edge, and a local server, such as VS Code’s Live Preview, to serve the page.

If you’ve already built Priya’s page, keep your files and carry on in them. If you’re starting here, the first lesson sets you up.

How the Course Works

In text lessons, you type along and check what the Console shows. The first four sections each end with an exercise, and automated tests check your code.

The project comes in three graded steps, and then you explain your scorekeeper to the mentor, RealJS’s AI tutor. A quiz and a summary close the course.

The next lesson is Add and Remove at the Ends.

Download

Course Slides (.pdf)

715.4 KB
Download

Sample Code (.zip)

14.4 KB

00:00 Welcome to Data Drives the Page. Priya hosts a game night. Her guest list is an array, but who’s arrived lives on the page, and the count drifts. This course makes the data the one truth.

00:14 Here’s the scorekeeper you’ll build.

00:18 Wei scores in round 1 and leads. In round 2, Amara scores twice and goes ahead.

00:26 Undo last round takes round 2 back, so Wei leads. Remove Wei, and with three tied at 0, nobody leads. Each click changes only the data. Your code then draws the page again from it, so the totals always match the scores.

00:44 First, you line up tonight’s games in arrays. Then one listener covers a whole list, even new rows. Next, the guest records become the one truth. Finally, you split the code into modules and build the scorekeeper.

01:03 By the end, you’ll be able to keep an app’s data in one place and redraw the page from it, with one listener handling a whole list, and split the app into modules.

01:15 You should know JavaScript basics, and how to find and create elements, listen for clicks, and change classes and data attributes. Use Chrome or Edge, and a local server, such as VS Code’s Live Preview.

01:30 Built Priya’s page? Keep your files. New here? The first lesson sets you up.

01:37 In text lessons, you type along and check the Console. The first four sections each end with an exercise, checked by automated tests. The project has three graded steps and a talk with the mentor, RealJS’s AI tutor.

01:53 A quiz and summary close the course. Next up: Add and Remove at the Ends.

Become a Member to join the conversation.