Scrolling value of elements in JavaScript

The following properties contain how much the element is scrolled:

javascriptconsole.log(elem.scrollTop);  // from top
console.log(elem.scrollLeft); // from left

The following example shows how these properties work. Scroll the element and click on the button, you will see the scroll amount:

Задание 1

Given an element and a button. By clicking on the button, find out how much the element is scrolled vertically.

Задание 2

Given an element and a button. On button click, check if the element is scrolled vertically.

Задание 3

Scroll to the bottom of the element. Press the button to display the full scroll value.

Задание 4

Get the element's scrollHeight and subtract the full scroll amount (take it from the previous task) from it. What will be the value? What dimensions does it contain?

Задание 5

Add offsetHeight and the amount of full scroll. Subtract this amount from scrollHeight. What number will come out?