Javascript - String sup() Method

The sup() method is used to display a string as superscript text.

Description

The sup() method is used to display a string as superscript text.

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

<sup>string</sup>

Syntax

string.sup()

Parameters

None

Return

A string embedded in the <sup> tag

Example

Display a string as superscript text:

Demo

//display a string as superscript text.
var str = "Hello World!";
var result = str.sup();
console.log(result);/*w ww . ja  va  2  s  . co m*/

Result