The following properties contain the dimensions of the browser window that don't include the scrollbar:
let w = document.documentElement.clientWidth; // a width
let h = document.documentElement.clientHeight; // a height
The following properties include the scrollbar:
let w = window.innerWidth; // a width
let h = window.innerHeight; // a height
The difference between the two property types gives the size of the scrollbar:
let w1 = document.documentElement.clientWidth;
let w2 = window.innerWidth;
console.log(w2 - w1);
On button click, display the width and height of the window.
On button click, check if the window has vertical scrolling.
On button click, check if the window has horizontal scrolling.