Let’s look at how to get the height and width of the viewport using Vanilla JS. We can use window.innerHeight to get the viewport height, and window.innerWidth to get viewport width.
let windowWidth = window.innerWidth; // get the window width let windowtHeight = window.innerHeight; // get the window height
Thanks for your time,
Best regards. Lucas.