This JavaScript tutorial explains how to use the string method known as fixed() with syntax and examples.
Description
In JavaScript, fixed() is a string method that is used to create the HTML element. Because the fixed() technique is a method of the String object, it need to be invoked through a unique occasion of the String class.
Syntax
In JavaScript, the syntax for the fixed() technique is:
string.fixed();
Parameters or Arguments
There are no parameters or arguments for the fixed() method.
Returns
The fixed() technique returns a reproduction of string enclosed in and tags.
Note
The fixed() technique does now not exchange the price of the unique string.
Example
Let’s take a seem at an example of how to use the fixed() approach in JavaScript.
For example:
var totn_string = 'TechOnTheNet';
console.log(totn_string.fixed());
In this example, we have declared a variable referred to as totn_string that is assigned the string cost of ‘TechOnTheNet’. We have then invoked the fixed() method of the totn_string variable to return a string that contains the HTML element.
We have written the output of the fixed() approach to the web browser console log, for demonstration purposes, to exhibit what the fixed() method returns.
The following will be output to the internet browser console log:
<tt>TechOnTheNet</tt>
As you can see, the fixed() approach created a string that includes a element. The fee of the totn_string variable (which is ‘TechOnTheNet’) is enclosed within the and tags.
Leave a Review