Equivalent of "element.scrollHeight" for "window" in Javascript?

javascript

Solution

document.documentElement.scrollHeight

Problem

What's the equivalent to `element.scrollHeight` for `window` in plain vanilla Javascript? I'm trying to rewrite code to target `window` or `document` instead of the `element`? Converting this: `remaining = element.scrollHeight - (element.clientHeight + element.scrollTop);` Into this: `remaining = window.scrollHeight - (window.innerHeight + window.pageYOffset);`

Original source