JavaScript String - fixed() Method



Description

This method causes a string to be displayed in fixed-pitch font as if it were in a <tt> tag.

Syntax

Its syntax is as follows −

string.fixed( )

Return Value

Returns the string with <tt> tag.

Example

Try the following example.

<html> <head> <title>JavaScript String fixed() Method</title> </head> <body> <script type = "text/javascript"> var str = new String("Hello world"); alert(str.fixed()); </script> </body> </html>

Output

<tt>Hello world</tt>
javascript_strings_object.htm
Advertisements