1// better than using window.innerWidth / window.innerHeight
2// because of scrollbars
3const client = {
4 width: document.documentElement.clientWidth,
5 height: document.documentElement.clientHeight
6}
1<p id="demo"></p>
2
3<script>
4document.getElementById("demo").innerHTML =
5"Screen width is " + screen.width;
6</script>