The abstract operation StringIndexOf takes arguments string (a String), searchValue (a String), and fromIndex (a non-negative
If searchValue is empty and fromIndex is less than or equal to the length of string, this algorithm returns fromIndex. An empty searchValue is effectively found at every position within a string, including after the last code unit.
The above algorithm accepts out-of-bounds fromIndex values (where fromIndex ≥ the length of string).
When the replaceAll
method is called with arguments searchValue and replaceValue, the following steps are taken:
Performs a regular expression match of the String representing the
When the matchAll
method is called, the following steps are taken:
"g"
).matchAll
function is intentionally generic, it does not require that its String.prototype.split
, String.prototype.matchAll
is designed to typically act without mutating its inputs.If searchString appears as a substring of the result of converting this object to a String, at one or more indices that are greater than or equal to position, then the smallest such index is returned; otherwise, -1 is returned. If position is
The indexOf
method takes two arguments, searchString and position, and performs the following steps:
The indexOf
function is intentionally generic; it does not require that its