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/description below:

Symbol.prototype.description - JavaScript | MDN

Symbol.prototype.description

Baseline Widely available

La propriété en lecture seule description est une chaîne de caractères qui renvoie la description optionnelle de l'objet Symbol.

Exemple interactif
console.log(Symbol("desc").description);
// Expected output: "desc"

console.log(Symbol.iterator.description);
// Expected output: "Symbol.iterator"

console.log(Symbol.for("foo").description);
// Expected output: "foo"

console.log(`${Symbol("foo").description}bar`);
// Expected output: "foobar"
Syntaxe
Symbol("maDescription").description;
Symbol.iterator.description;
Symbol.for("toto").description;
Description

Les objets Symbol peuvent être créés avec une description facultative qui peut être utilisée pour du débogage mais sans accéder au symbole. La propriété Symbol.prototype.description peut être utilisée afin de lire cette description. Cette propriété est différente de Symbol.prototype.toString() car elle ne contient pas la chaîne de caractères "Symbol()" autour de la description (voir les exemples qui suivent).

Exemples
Symbol("desc").toString(); // "Symbol(desc)"
Symbol("desc").description; // "desc"
Symbol("").description; // ""
Symbol().description; // undefined

// symboles connus
Symbol.iterator.toString(); // "Symbol(Symbol.iterator)"
Symbol.iterator.description; // "Symbol.iterator"

// symboles globaux
Symbol.for("toto").toString(); // "Symbol(toto)"
Symbol.for("toto").description; // "toto"
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