blob: fb17ea0e00a9d6dad2b9616d165d98206b8a9f8f (
plain)
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
|
// 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-set.prototype.delete
description: >
Set.prototype.delete ( value )
...
4. Let entries be the List that is the value of S’s [[SetData]] internal slot.
5. Repeat for each e that is an element of entries,
a. If e is not empty and SameValueZero(e, value) is true, then
b. Replace the element of entries whose value is e with an element whose value is empty.
c. Return true.
...
---*/
var s = new Set([-0]);
assert.sameValue(s.size, 1, "The value of `s.size` is `1`");
var result = s.delete(+0);
assert.sameValue(s.size, 0, "The value of `s.size` is `0`, after executing `s.delete(-0)`");
assert.sameValue(result, true, "The result of `s.delete(+0)` is `true`");
reportCompare(0, 0);
|