Before you start, here’s a quick tour of how exercises on RealJS work.
How Coding Exercises Work
It runs right here in your browser, so you don’t need your agent, your terminal or Node for it. Write your code in the editor above, then click Run Tests or press Ctrl+Enter (Cmd+Enter on macOS). Automated tests check your code and mark each test as passed or failed.
The starter code in the editor is a small JavaScript file. Lines marked // Provided for you are ready-made code you only need to read, and a // TODO: comment marks each spot where your code goes. The tests import what the file exports, so keep the export keywords where they are.
Run the tests early and often, even before you change anything. A failing test’s message tells you what it found and what it expected, so read it before you edit. Fix the first failing test, then run the tests again. A different failing test usually means you made progress!
Note: If every test fails with the same short error, then JavaScript couldn’t read your code. Check the line the message names and fix that first.
Getting stuck is normal. The Hints tab nudges you one step at a time, so see whether one hint is enough to get you going. Thinking it through yourself is where most of the learning happens. You can also ask Code Mentor about the exercise and your code at any time.
For more room, click Full screen or press T while you’re not typing in the editor. When you’re done, open the Solution tab to compare your approach and read the notes.
Once you’ve finished this exercise, the next lesson, Install and Start Your Agent, sets up a real agent on your own machine.