Command Palette

Search for a command to run...

Hectal
Phase 0: Start Here: What JavaScript Is
JavaScript · Exercise 5 of 5 Previous
Beginner

A café bill on the page

Build a small bill. The order is 2 teas at 30 rupees, 3 samosas at 15 and 1 juice at 50.

Fill each list item with its line total, like Tea x2 = 60, put Total: 155 in the #total paragraph and also log Total: 155 to the console.

Let JavaScript do the maths, and write a comment above each step.

What Check tests

  1. The tea line shows 60
  2. The samosa line shows 45
  3. The juice line shows 50
  4. The page shows Total: 155
  5. The console shows Total: 155
  6. JavaScript works out the total (155 isn't typed in)
  7. 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.