Are you ready?
7 questions to solve
Instructions
- This quiz goes to full-screen once you press the Start button.
- At the end of the quiz, you are able to review all the questions that you answered wrong and see their explanations.
Which of the properties
pageXOffset
and scrollX
is older than the other?pageXOffset
is an older property if we compare it to scrollX
. Both do exactly the same thing i.e return the vertical scroll offset of the HTML document. For more info, refer to JavaScript Scroll Event.The
pageXOffset
property is available on all element nodes. True or false?How to get the vertical scroll offset of a given element?
For an element, its vertical scroll offset can be determined by querying the
scrollTop
property. However for the case of window
, this thing is done using scrollY
or pageYOffset
.Is there any way to programatically change the scroll offset of an element. If yes, then what is it?
The
scroll()
method is one of the ways to programatically change the vertical scroll offset of an element. This goes with choice C). The other ways are scrollTo()
, scrollBy()
and scrollTop
.The
scroll()
and scrollTo()
methods do the same thing. True or false?scroll()
and scrollTo()
do exactly the same thing. It's just that scroll()
is a bit older compared to scrollTo()
.Is the following code correct to navigate the HTML document to a vertical scroll offset of 10px?
window.scrollY = 10;
Assigning a value to the property
scrollY
has no effect. This means that the code above is technically not correct for the given task. See more at JavaScript Scroll Event.What does it mean to debounce the
onscroll
handler?Debouncing means to wait for a certain amount of time before firing a function from within the handler of the
scroll
event. This goes with choice B). See more details at JavaScript Scroll Event - Debouncing.