From 33058f2b292b3a581333bdfb21b8f671898c5060 Mon Sep 17 00:00:00 2001 From: Peter Bengtsson Date: Tue, 8 Dec 2020 14:40:17 -0500 Subject: initial commit --- .../reference/objets_globaux/map/has/index.html | 79 ++++++++++++++++++++++ 1 file changed, 79 insertions(+) create mode 100644 files/fr/web/javascript/reference/objets_globaux/map/has/index.html (limited to 'files/fr/web/javascript/reference/objets_globaux/map/has/index.html') diff --git a/files/fr/web/javascript/reference/objets_globaux/map/has/index.html b/files/fr/web/javascript/reference/objets_globaux/map/has/index.html new file mode 100644 index 0000000000..aed14c0662 --- /dev/null +++ b/files/fr/web/javascript/reference/objets_globaux/map/has/index.html @@ -0,0 +1,79 @@ +--- +title: Map.prototype.has() +slug: Web/JavaScript/Reference/Objets_globaux/Map/has +tags: + - ECMAScript 2015 + - JavaScript + - Map + - Méthode + - Prototype + - Reference +translation_of: Web/JavaScript/Reference/Global_Objects/Map/has +--- +
{{JSRef}}
+ +

La méthode has() renvoie un booléen permettant de déterminer si l'objet Map en question contient la clé donnée.

+ +
{{EmbedInteractiveExample("pages/js/map-prototype-has.html")}}
+ + + +

Syntaxe

+ +
maMap.has(clé);
+ +

Paramètres

+ +
+
clé
+
Ce paramètre obligatoire correspond à la clé dont on veut savoir si elle appartient à l'objet Map.
+
+ +

Valeur de retour

+ +

Cette méthode renvoie un booléen : true si un élément avec cette clé existe au sein de l'objet Map et false sinon.

+ +

Exemples

+ +
var maMap = new Map();
+maMap.set("truc", "toto");
+
+maMap.has("truc");  // renvoie true
+maMap.has("machin");// renvoie false
+
+ +

Spécifications

+ + + + + + + + + + + + + + + + + + + +
SpécificationÉtatCommentaires
{{SpecName('ES2015', '#sec-map.prototype.has', 'Map.prototype.has')}}{{Spec2('ES2015')}}Définition initiale.
{{SpecName('ESDraft', '#sec-map.prototype.has', 'Map.prototype.has')}}{{Spec2('ESDraft')}} 
+ +

Compatibilité des navigateurs

+ + + +

{{Compat("javascript.builtins.Map.has")}}

+ +

Voir aussi

+ + -- cgit v1.2.3-54-g00ecf