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);//from w w w  .  j a v a2s .  c  o m

Result