JavaScript > Methods

Superscript style in JavaScript

How to apply superscript style to the text in JavaScript?

In case we want to apply the subscript style to the text in the html page, we can use this approach.

        document.write("This is Superscript text ");
        document.write(" This is Superscript text".sup());

In the above code snippet, we have written “This is Superscript text” in both document.write lines but in the 2nd statement we have called the sup() method using the text that makes this text in superscript style as you can see in the below picture.


 Views: 9211 | Post Order: 49

Write for us

Hosting Recommendations