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
- The list starts empty
- The first message has data-id
m1and showsm1: Hello - The second message has data-id
m2 - 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.