-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy path2-map.js
More file actions
21 lines (15 loc) · 527 Bytes
/
Copy path2-map.js
File metadata and controls
21 lines (15 loc) · 527 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
'use strict';
const cityPopulation = new Map();
cityPopulation.set('Shanghai', 24256800);
cityPopulation.set('Beijing', 21516000);
cityPopulation.set('Delhi', 16787941);
cityPopulation.set('Lagos', 16060303);
cityPopulation.delete('Shanghai');
if (cityPopulation.has('Beijing')) {
console.log('Beijing:', cityPopulation.get('Beijing'));
}
if (!cityPopulation.has('Shanghai')) {
console.log('no data for Shanghai');
}
console.log('size:', cityPopulation.size);
console.log('keys:', [...cityPopulation.keys()]);