FrontendArk

Master Frontend Interviews

  • Practice
  • Playground
  • Resource
Easy

Click Anywhere Handler

5min

Implement a function clickAnywhere that registers a handler to run whenever the user clicks anywhere on the document. The handler should receive the MouseEvent as its only argument.

The function should also return a cleanup function that removes the event listener when called.

Code Editor

JavaScript Function

00:00
Loading...

Test Cases

No test results yet

Click "Run" to execute tests