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: 2020-05-20T08:47:55+05:30

164 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements