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/Map/has below:

Map.prototype.has() - JavaScript | MDN

Map.prototype.has()

Baseline Widely available

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

Exemple interactif
const map1 = new Map();
map1.set("bar", "foo");

console.log(map1.has("bar"));
// Expected output: true

console.log(map1.has("baz"));
// Expected output: false
Syntaxe 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 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