Symbol.search
Symbol.search 静态数据属性代表 众所周知的符号 Symbol.search。String.prototype.search() 方法在其第一个参数上查找此符号,以查找返回与当前对象匹配的字符串中的索引的方法。
¥The Symbol.search static data property represents the well-known symbol Symbol.search. The String.prototype.search() method looks up this symbol on its first argument for the method that returns the index within a string that matches the current object.
有关详细信息,请参阅 RegExp.prototype[Symbol.search]() 和 String.prototype.search()。
¥For more information, see RegExp.prototype[Symbol.search]() and String.prototype.search().
Try it
值
示例
自定义字符串搜索
规范
| Specification |
|---|
| ECMAScript Language Specification # sec-symbol.search |
浏览器兼容性
BCD tables only load in the browser