Command Palette

Search for a command to run...

Hectal
Phase 4: Conversation State
AI Frontend · Exercise 1 of 5Next
Beginner

Number the Messages

Each click on #add adds a message to the list #list. Every message must be an li with a unique id in its data-id attribute: m1 for the first, m2 for the second, and so on.

The counter is already declared. Use it to make the ids, and show the id before the text, like m1: Hello.

What Check tests

  1. The list starts empty
  2. The first message has data-id m1 and shows m1: Hello
  3. The second message has data-id m2
  4. All ids are different

Stuck? One hint at a time

The solution unlocks after your first Check. Try first: that is where the learning happens.

Runs in your browser. Your code is saved here.

Your page

Press Run to see the page.

Console

Nothing logged yet.