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

HTMLJavascriptProgramming Scripts

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>
raja
Updated on 20-May-2020 08:47:55

Advertisements