JavaScript · Middle · Question 43 of 75

What does the { passive: true } option in addEventListener('touchmove', ...) do?

Explanation

The browser doesn't know in advance whether a handler will cancel scrolling, so it waits for it to run. A passive handler lets scrolling start immediately - noticeably smoother on mobile. For a one-time handler there's once; for the capturing phase, capture.

Further reading

Problem with a question

JavaScript · Middle · question 43

Test yourself

Take the JavaScript · Middle quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz