How can I use JavaScript to scroll to the bottom of the page automatically?

I’ve worked quite a bit with page scrolling, and one super reliable method for javascript scroll to bottom is using window.scrollTo combined with document.body.scrollHeight. It’s simple and does the job.

function scrollToBottom() {
    window.scrollTo(0, document.body.scrollHeight);
}

document.getElementById('question1').addEventListener('click', scrollToBottom);

Basically, when the user clicks the element with ID question1, the page instantly jumps to the bottom. Why it works: scrollHeight gives the total height of the content, so this scrolls you all the way down — no matter how long the page is.