A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developer.mozilla.org/fr/docs/Web/JavaScript/Reference/Global_Objects/Symbol/replace below:

Symbol.replace - JavaScript | MDN

Symbol.replace

Baseline Widely available

Le symbole connu Symbol.replace définit la méthode utilisée pour remplacer les correspondances trouvées dans une chaîne de caractères. Cette fonction est appelée par la méthode String.prototype.replace().

Pour plus d'informations, se référer aux pages sur RegExp.prototype[@@replace]() et String.prototype.replace().

Exemple interactif
class Replace1 {
  constructor(value) {
    this.value = value;
  }
  [Symbol.replace](string) {
    return `s/${string}/${this.value}/g`;
  }
}

console.log("foo".replace(new Replace1("bar")));
// Expected output: "s/foo/bar/g"
Écrivable Non Énumérable Non Configurable Non Spécifications Compatibilité des navigateurs Voir aussi

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4