1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
// Copyright (C) 2015 the V8 project authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-map.prototype.get
description: >
Returns undefined when key is not on the map.
info: |
Map.prototype.get ( key )
4. Let entries be the List that is the value of M’s [[MapData]] internal slot.
5. Repeat for each Record {[[key]], [[value]]} p that is an element of
entries,
a. If p.[[key]] is not empty and SameValueZero(p.[[key]], key) is true,
return p.[[value]].
6. Return undefined.
...
---*/
var map = new Map();
assert.sameValue(
map.get('item'), undefined,
'returns undefined if key is not on the map'
);
map.set('item', 1);
map.set('another_item', 2);
map.delete('item');
assert.sameValue(
map.get('item'), undefined,
'returns undefined if key was deleted'
);
map.set('item', 1);
map.clear();
assert.sameValue(
map.get('item'), undefined,
'returns undefined after map is cleared'
);
reportCompare(0, 0);
|