JavaScript String sub() Method

Definition and Usage

The sub() function in JavaScript is deprecated.

Please avoid using it.

It may stop running at any time in your browser.

sub() The method returns the string embedded in the <sub> tag:

<sub>string</sub>

Example

let text = "Hello World!";
let result = text.sub();

Try It Yourself

Syntax

string.sub()

Parameters

No parameters.

Return Value

String embedded in the <sub> tag.