How to return a number of bits used to display one color on a window screen in JavaScript?

HTMLJavascriptProgramming Scripts

Use the screen.colorDepth property in JavaScript to return a number of bits used to display a color on the window screen.

Example

You can try to run the following code to return the screen color depth in JavaScript.

<!DOCTYPE html>
<html>
   <body>
      <script>
         document.write("Screen width: " + screen.width);
         document.write("<br>Screen height: " + screen.height);
         document.write("<br>Color Depth: " + screen.colorDepth);
      </script>
   </body>
</html>
raja
Published on 26-Feb-2018 10:35:29
Advertisements