Implement a utility useWindowSize() that returns the current height and width of the window.
It should automatically update whenever the window is resized, triggering re-renders (in React) or updates in plain JS.
Your task: Implement useWindowSize so that it:
{ width, height }.Example
const screen = useWindowSize(); // Suppose window.innerWidth = 1200, window.innerHeight = 800 console.log(screen); // { width: 1200, height: 800 }
JavaScript Function
No test results yet
Click "Run" to execute tests