Name

substring() — NN 2 IE J1 ECMA 1

Synopsis

substring(startPositionIndex, endPositionIndex)

Returns a copy of an extract from the current string. The extract begins at the zero-based index position of the current string as specified by the first parameter of the method and ends at the character whose index is specified by the second parameter. In contrast, the substr() method’s parameters point to the start position of the main string and the number of characters (length) to extract.

Returned Value

A string.

Parameters

startPositionIndex

A zero-based integer indicating the position within the current string object to start copying characters

endPositionIndex

A zero-based integer indicating the position within the current string object to end copying characters

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.