What is JavaScript — exercises and bug fixes
5 hands-on exercises and 5 find-the-bug challenges for the What is JavaScript lesson. Every one is checked automatically in the browser — write the code, run it, and the tests tell you what still fails.
Exercises(5)
- 1
Make the page say something
easy10 minUse JavaScript to put the word "running" into #out.
- 2
Do a calculation in the page
easy10 minWork out 6 times 7 and show the result.
- 3
Read something from the page
easy10 minRead the heading's text and show it.
- 4
Change a style from JavaScript
easy10 minSet #out's colour to red, then report "styled".
- 5
Store and reuse a value
medium10 minStore a browser fact in a variable and show "dynamic".
Find the bug(5)
- 1
Fix the wrong selector
easy8 minThe code targets an element that does not exist.
- 2
Fix the misspelled property
easy8 mintextContent is spelled wrong, so nothing appears.
- 3
Fix the missing quotes
easy8 minThe text is unquoted, so JavaScript looks for a variable.
- 4
Fix the wrong method name
easy8 minquerySelectorAll returns a list, not one element.
- 5
Fix the reversed assignment
easy8 minThe assignment is written backwards.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspace