Skip to content

Create a HTML tt element from a JavaScript string

This JavaScript tutorial explains how to create a HTML <tt> tag using the string method called fixed() with syntax and examples.

In JavaScript, fixed() is a string method that is used to create the HTML <tt> element. Because the fixed() method is a method of the String object, it must be invoked with an instance of the String class.




var myString = 'Poopcode';

console.log(myString.fixed()); // <tt>Poopcode</tt>
See also  Shuffle/Randomize an array in JavaScript using Knuth Fisher-Yates shuffle algorithm

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.