Javascript examples for String:sup
The sup() method displays a string as superscript text.
This method returns the string embedded in the <sup> tag, like this:<sup>string</sup>
None.
A string embedded in the <sup> tag
The following code shows how to Display a string as superscript text:
<!DOCTYPE html> <html> <body> <button onclick="myFunction()">Test</button> <p id="demo"></p> <script> function myFunction() {/*from ww w . j ava 2 s . c o m*/ var str = "Hello World!"; var result = str.sup(); document.getElementById("demo").innerHTML = result; } </script> </body> </html>