Fix Array.prototype.reduce and reduceRight (#3487)

Don't throw TypeError when object length is 0 and initialValue is undefined.
Additionally the error message should be more precise and match other engines.

Fixes #3463

JerryScript-DCO-1.0-Signed-off-by: Csaba Osztrogonác oszi@inf.u-szeged.hu
This commit is contained in:
Csaba Osztrogonác
2020-01-06 15:17:54 +01:00
committed by Robert Fancsik
parent 40b38f70ef
commit 9e0709e401
4 changed files with 8 additions and 12 deletions
+2
View File
@@ -39,6 +39,8 @@ catch(e) {
// various checks
assert ([].reduce(func, 1) === 1);
assert ([].reduce(func, undefined) === undefined);
assert ([0].reduce(func) === 0);
assert ([0, 1].reduce(func) === 1);