Loading search index…
No recent searches
No results for "Query here"
The Symbol.replace static data property represents the well-known symbol @@replace. The String.prototype.replace() method looks up this symbol on its first argument for the method that replaces substrings matched by the current object.
Symbol.replace
@@replace
String.prototype.replace()
For more information, see RegExp.prototype[@@replace]() and String.prototype.replace().
RegExp.prototype[@@replace]()
The well-known symbol @@replace.
class CustomReplacer { constructor(value) { this.value = value; } [Symbol.replace](string) { return string.replace(this.value, "#!@?"); } } console.log("football".replace(new CustomReplacer("foo"))); // "#!@?tball"
replace
core-js
Symbol.match
Symbol.matchAll
Symbol.search
Symbol.split
© 2005–2023 MDN contributors.Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol/replace