AI Hints
Home›JavaScript Tutorial›Quiz App and Timers
JavaScript · Lesson 105 of 138

DOM Quiz

Test yourself.

⏱ 2 min read▶ Video at 2:05:29🎓 Free
Watch this lesson in the JavaScript courseWatch on YouTube ↗Full JavaScript course

Time to check what you've learned about JavaScript in the browser. Pause after each question, and answer it before I do.

DOM Quiz
From the video: DOM Quiz
  • DOM quiz
  • Pause and think
  • Then check

Question 1

Which method finds the first element matching a CSS selector? The answer is query selector.

Quick check
First element matching a selector?

Question 2

Which property safely sets plain text, without parsing tags? The answer is text content.

Quick check
Safe for user input?

Question 3

How do you stop a form from reloading the page when it's submitted? The answer is e dot prevent default.

Quick check
Stop the reload?

Question 4

What does local storage store? The answer is strings. Use JSON for arrays and objects.

Quick check
localStorage stores...

Summary

Well done. Next, a new section. JavaScript outside the browser, with Node.

Key takeaways
  • querySelector
  • textContent
  • preventDefault
Next up: Node and Files — JavaScript on your computer