Fix undefined initialValue handling in Array.prototype.reduce and reduceRight function.
JerryScript-DCO-1.0-Signed-off-by: Kristof Kosztyo kkosztyo.u-szeged@partner.samsung.com
This commit is contained in:
@@ -61,3 +61,13 @@ assert (long_array.reduce(func,10) === 11);
|
||||
|
||||
long_array[10000] = 1;
|
||||
assert (long_array.reduce(func,10) === 12);
|
||||
|
||||
var accessed = false;
|
||||
function callbackfn(prevVal, curVal, idx, obj) {
|
||||
accessed = true;
|
||||
return typeof prevVal === "undefined";
|
||||
}
|
||||
|
||||
var obj = { 0: 11, length: 1 };
|
||||
|
||||
assert (Array.prototype.reduce.call(obj, callbackfn, undefined) === true && accessed);
|
||||
|
||||
Reference in New Issue
Block a user