blob: d524ef734a0997008f803527823acac2fe12d14a (
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
28
29
|
// Copyright (c) 2023 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-object.groupby
description: Object.groupBy returns a null prototype object
info: |
Object.groupBy ( items, callbackfn )
...
2. Let obj be OrdinaryObjectCreate(null).
...
4. Return obj.
...
features: [array-grouping]
---*/
const array = [1, 2, 3];
const obj = Object.groupBy(array, function (i) {
return i % 2 === 0 ? 'even' : 'odd';
});
assert.sameValue(Object.getPrototypeOf(obj), null);
assert.sameValue(obj.hasOwnProperty, undefined);
reportCompare(0, 0);
|