JavaScript sup()Method

String 对象参考手册JavaScript String Object

Definition and Usage

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

This method returns the string with the <sup> tag added, as follows:

<sup>string</sup>

Syntax

string.sup()


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the sup() method.


Examples

Examples

Display a text string as superscript:

<script>

var str = "Hello world!";
document.write(str.sup());

</script>

Try it Yourself »


String 对象参考手册JavaScript String Object Other Extensions