How to display a string in the fixed-pitch font?


Use the JavaScript fixed() method to display in fixed-pitch font as if it were in a <tt> tag.

Example

You can try to run the following code to display a string in the fixed-pitch font.

<html>
   <head>
      <title>JavaScript String fixed() Method</title>
   </head>

   <body>
      <script>
         var str = new String("Hello world");
         alert(str.fixed());
      </script>
   </body>
</html>

Updated on: 20-May-2020

92 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements