get screen size in javascript

You can get the width and height of the user's screen using the screen object in JavaScript:

index.tsx
let screenWidth = window.screen.width;
let screenHeight = window.screen.height;

console.log("Screen width: " + screenWidth);
console.log("Screen height: " + screenHeight);
173 chars
6 lines

This will give you the screen resolution in pixels. Note that this may not be the same as the browser window size or the device's physical screen size.

gistlibby LogSnag