blob: 653ea7b9216f972e5b5ab45e0758891c0b4d0d21 [file] [log] [blame]
// 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 - element to be retrieved is own data
property that overrides an inherited data property on an Array
---*/
var testResult = false;
var initialValue = 0;
function callbackfn(prevVal, curVal, idx, obj) {
if (idx === 1) {
testResult = (curVal === 1);
}
}
Array.prototype[1] = "3";
[0, 1, 2].reduce(callbackfn, initialValue);
assert(testResult, 'testResult !== true');