String.prototype.searchbeginner'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.
When the regex has no match, .search() returns -1.
Challenge: Implement hasUpperCase(str) that returns true if the string contains an uppercase letter.
hasUpperCase('Hello') // β true
hasUpperCase('hello') // β false