String.prototype.searchintermediate'hello world'.search(/world/) // β 6
'hello'.search(/d/) // β -1
'abc123'.search(/[0-9]/) // β 3Use search() to find the index of the first regex match in a string, returning -1 if not found.
Add the i flag to make the search case-insensitive.
Challenge: Implement findWordIndex(str, word) that returns the index of word (case-insensitive).
findWordIndex('Hello World', 'world') // β 6
findWordIndex('Hello World', 'HELLO') // β 0