-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy path6-weak.js
More file actions
19 lines (15 loc) · 471 Bytes
/
Copy path6-weak.js
File metadata and controls
19 lines (15 loc) · 471 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
'use strict';
const cities = {
beijing: { name: 'Beijing' },
kiev: { name: 'Kiev' },
london: { name: 'London' },
baghdad: { name: 'Baghdad' },
};
const capitalOf = new WeakMap();
capitalOf.set(cities.beijing, 'People\'s Republic of China');
capitalOf.set(cities.kiev, 'Ukraine');
capitalOf.set(cities.london, 'United Kingdom');
capitalOf.set(cities.baghdad, 'Iraq');
delete cities.london;
capitalOf.delete(cities.baghdad);
console.dir({ cities, capitalOf });