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