EN
JavaScript - get desktop screen width
0
points
In this article, we would like to show you how to get desktop screen width using JavaScript.
Quick solution:
// ONLINE-RUNNER:browser;
console.log(screen.width);
Practical example
In this example, we present a full example of how to get a desktop screen width.
// ONLINE-RUNNER:browser;
<!doctype html>
<html>
<body>
<script>
var width = screen.width;
console.log('width: ' + width);
</script>
</body>
</html>