blob: bd1c1e68f941691ad1b38eaee2867682b4634abc (
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
30
31
32
33
34
35
36
37
|
// Copyright (c) 2012 Ecma International. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.reduce
description: Array.prototype.reduce - non-indexed properties are not called
---*/
var accessed = false;
var result1 = true;
var result2 = true;
function callbackfn(prevVal, curVal, idx, obj) {
accessed = true;
if (curVal === 8) {
result1 = false;
}
if (prevVal === 8) {
result2 = false;
}
}
var obj = {
0: 11,
10: 12,
non_index_property: 8,
length: 20
};
Array.prototype.reduce.call(obj, callbackfn, 1);
assert(result1, 'result1 !== true');
assert(result2, 'result2 !== true');
assert(accessed, 'accessed !== true');
reportCompare(0, 0);
|