The static data property represents the well-known symbol @@search. The method looks up this symbol on its first argument for the method that returns the index within a string that matches the current object.

For more information, see RegExp.prototype[@@search]() and

Try it


The well-known symbol @@search.

Property attributes of
Writable no
Enumerable no
Configurable no


class caseInsensitiveSearch {
  constructor(value) {
    this.value = value.toLowerCase();
  [](string) {
    return string.toLowerCase().indexOf(this.value);

console.log("foobar".search(new caseInsensitiveSearch("BaR"))); // 3


ECMAScript Language Specification

Browser compatibility

BCD tables only load in the browser

See also