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