Window dimensions including scrolling in JavaScript

Let's get the dimensions of the window considering the scrolled part. Unfortunately, there is no convenient way that works in all browsers. Following are working solutions. You don't have to go into them, just use them.

A height including scrolled part:

javascriptlet scrollHeight = Math.max(
  document.body.scrollHeight, document.documentElement.scrollHeight,
  document.body.offsetHeight, document.documentElement.offsetHeight,
  document.body.clientHeight, document.documentElement.clientHeight
);

console.log(scrollHeight);

A width including scrolled part:

javascriptlet scrollWidth = Math.max(
  document.body.scrollWidth, document.documentElement.scrollWidth,
  document.body.offsetWidth, document.documentElement.offsetWidth,
  document.body.clientWidth, document.documentElement.clientWidth
);

console.log(scrollWidth);
Задание 1

On button click, display the height considering the scrolled part.

Задание 2

On button click, display the width considering the scrolled part.

Задание 3

On button click, display the height of the part hidden under the scrolling.