JavaScript sup()Method
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
![]()
![]()
![]()
![]()
![]()
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>
var str = "Hello world!";
document.write(str.sup());
</script>
Try it Yourself »
JavaScript String Object Other Extensions