# How to change string to be displayed as a subscript using JavaScript?

JavascriptWeb DevelopmentFront End Technology

To change the string to be displayed as a subscript using JavaScript, use the sub() method. This method causes a string to be displayed as a subscript as if it were in a <sub> tag.

## Example

You can try to run the following code to change the string to be displayed as a subscript −

Live Demo

<html>
</html>