This is the course’s first coding exercise, so here’s how exercises on RealJS work before you start on the thresholds.
How Coding Exercises Work
A coding exercise runs right here in your browser, with no project, key, or install. Write your code in the editor above, then click Run Tests or press Ctrl+Enter (Cmd+Enter on macOS). Automated tests run your code and mark each test as passed or failed.
In this course, the exercises never call a real model. The tests hand your code recorded data, such as the scores OpenAI’s moderation model gave the lesson’s labeled questions on December 2, 2026, and a stand-in for the call your project would make. So your results match everyone else’s.
Run the tests early and often, even before you change anything. A failing test’s message says what it found and what it expected, so read it before you edit. Fix the first failing test, then run the tests again. A test that says to get another one passing first is waiting on that one, so start there.
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.
If you’re stuck, the Hints tab nudges you one step at a time, so see whether one hint is enough to get you going. You can also ask your 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 the tests pass, the next lesson, Check Answers in Code, turns to what moderation can’t catch: answers that state conditions no report gave.