String.prototype.search

Returns an index of the first substring match in the string.

Syntax

search(value)

Parameters

Return value

The index of the first match, or -1 if not found.

Examples

"Mayday Parade".search("ay")
1
"Blink-182".search(/\d/)
6