JavaScript navigator Object — exercises and bug fixes
5 hands-on exercises and 5 find-the-bug challenges for the JavaScript navigator Object 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
Check the online state type
easy10 minReport the type of navigator.onLine.
- 2
Read the language
easy10 minReport the type of navigator.language.
- 3
Check for a feature
easy10 minWrite a function that checks for clipboard support.
- 4
Check languages is a list
easy10 minReport whether navigator.languages is an array.
- 5
Check userAgent exists
medium10 minReport the type of navigator.userAgent.
Find the bug(5)
- 1
Fix the type check inverted
easy8 minThe check for a boolean was written backwards.
- 2
Fix the browser name checked instead of the feature
easy8 minChecking for the feature itself is more reliable than the browser name.
- 3
Fix languages read as one string
easy8 minnavigator.languages is a list of preferences, not a single string.
- 4
Fix clipboard called before checking for it
easy8 minTest for the feature before relying on it, in case it is missing.
- 5
Fix the wrong case used for onLine
easy8 minThe property is spelled onLine with a capital L.
Ready to write the code?
The editor, the automatic checks and the worked solutions open up with an account.
Open the workspace