How to return pixel depth of the screen in JavaScript?

HTMLJavascriptProgramming Scripts

To return the pixel depth of the screen, use the screen.pixelDepth property in JavaScript.

Example

You can try to run the following code to get the pixel depth in JavaScript.

<!DOCTYPE html>
<html>
   <body>
      <script>
         document.write("Screen width: " + screen.width);
         document.write("<br>Screen height: " + screen.height);
         document.write("<br>Pixel Depth: " + screen.pixelDepth);
      </script>
   </body>
</html>
raja
Published on 26-Feb-2018 15:08:03
Advertisements