Determine the screen width in JavaScript

Introduction

If you need to determine the screen width, it is logical to use JavaScript

Example

Create a file width.html Add all the required tags and something else

width.html

<div class="p1 anchor">Device Screen Width: <span id="example"></span></div> <script> document.getElementById("example").textContent = screen.width; </script>

Article author: Andrei Olegovich