Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

JavaScript sub() Method

JavaScript sub() Method

String Object Reference JavaScript String object


Definition and Usage

The sub() method is used to display a string as a subscript.

This method returns a string with the tag added, as shown below:

string

Syntax

string

.sub()


Browser support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the sub() method.


Example

Example

Display the string as a subscript:

Try it »


String Object Reference JavaScript String object