String fixed() Method - Javascript String

Javascript examples for String:fixed

Description

The fixed() method is used to display a string as teletype text.

This method returns the string embedded in the <tt> tag, like this: <tt>string</tt>

Parameters

None.

Return Value:

A string embedded in the <tt> tag

The following code shows how to Display text as teletype text:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {/*from w  ww  .j  a  v  a  2  s . c  o  m*/
    var str = "Hello World!";
    var result = str.fixed();
    document.getElementById("demo").innerHTML = result;
}
</script>

</body>
</html>

Related Tutorials