Command Palette

Search for a command to run...

Hectal
Phase 8: The DOM
JavaScript · Exercise 2 of 5 PreviousNext
Beginner

Count and mark finished tasks

The list has tasks; finished ones carry data-done="true".

1. Write the total number of tasks into #total.

2. Write the number of finished tasks into #done.

3. Add the class done to every finished task (the CSS crosses them out).

Work the numbers out with JavaScript, so they stay right if the list changes.

What Check tests

  1. #total shows 5
  2. #done shows 2
  3. Exactly the finished tasks have the class done
  4. The numbers are counted, not typed in
  5. No errors

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.