Scroll an element to the end in JavaScript

Let's scroll the element to the very bottom:

javascriptelem.scrollTop = elem.scrollHeight - elem.clientHeight;
Задание 1

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

Задание 2

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