Scroll an element to the end in JavaScript

Let's scroll the element to the very bottom:

elem.scrollTop = elem.scrollHeight - elem.clientHeight;

Given an element and a button. Scroll the element to the very bottom by clicking on the button.

Given an element and a button. On clicking the button, check if the element is scrolled to the end vertically.

enru