Map.prototype.set(key,
value)
This
method set the value for given key.
Find
the below working application.
var countriesMap = new Map(); countriesMap.set("Bahrain", "Manama"); countriesMap.set("Cameroon", "Yaounde"); countriesMap.set("Norway", "Oslo"); countriesMap.set("India", "New Delhi"); console.log("Is countriesMap has Norway : " + countriesMap.has("Norway")); console.log("Is countriesMap has India : " + countriesMap.has("India")); console.log("Is countriesMap has Australia : " + countriesMap.has("Australia"));
Output
Is
countriesMap has Norway : true
Is
countriesMap has India : true
Is countriesMap has Australia : false
Is countriesMap has Australia : false
No comments:
Post a Comment