javascript get window width code example
Example 1: how to get the height of window in javascript
window.innerHeight
window.innerWidth
Example 2: get window size javascript
const window {
width: window.innerWidth,
height: window.innerHeight
}
Example 3: JS get viewport width
var width= Math.max(document.documentElement.clientWidth, window.innerWidth || 0);
var height = Math.max(document.documentElement.clientHeight, window.innerHeight || 0);
Example 4: get screen width javascript
window.screen.width
screen.width
Example 5: js window dimensions
const client = {
width: document.documentElement.clientWidth,
height: document.documentElement.clientHeight
}
Example 6: java script find screen size of device
$(window).height();
$(window).width();
$(document).height();
$(document).width();