Standard built-ins
Symbol.search
Key consulted by string search for a custom matching operation. Conventional search returns the first matching offset or -1.
Formal Syntax & Structure
javascript syntaxjavascript
Symbol.searchReturn Value
symbol
The predefined protocol key.
Working Example
Example Snippetjavascript
const x={[Symbol.search](s){return s.indexOf("b");}};console.log("abc".search(x));