String.prototype.substr

Returns a substring beginning at the specified location and having the specified length.

Note

This method is considered deprecated. Use substring instead.

Syntax

substr(start, length?)

Parameters

Return value

A string.

Examples

"spring".substr(1, 3)
"pri"
"spring".substr(1)
"pring"

See also