We can use the document.body.scrollHeight
to get the full height of the content, including the content off the screen.
document.body.clientHeight
has the height of the content on the screen.
Therefore, we can check if the page has a vertical scrollbar by comparing the 2.
To do this, we write:
const hasVScroll = document.body.scrollHeight > document.body.clientHeight;
console.log(hasVScroll)