Baseline Widely available
La propriété flags
renvoie une chaîne de caractères contenant les drapeaux (flags) de l'objet RegExp
auquel elle appartient.
// Outputs RegExp flags in alphabetical order
console.log(/foo/gi.flags);
// Expected output: "gi"
console.log(/bar/muy.flags);
// Expected output: "muy"
Ãcrivable Non Ãnumérable Non Configurable Oui Description
Les drapeaux de la propriété flags
sont rangés par ordre alphabétique de gauche à droite.
flags
/toto/gi.flags; // "gi"
/truc/muy.flags; // "muy"
Prothèse d'émulation (polyfill)
if (RegExp.prototype.flags === undefined) {
Object.defineProperty(RegExp.prototype, "flags", {
configurable: true,
get: function () {
return this.toString().match(/[gimuy]*$/)[0];
},
});
}
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