Skip to content

Commit

Permalink
Add missed check in array-reduce.js
Browse files Browse the repository at this point in the history
  • Loading branch information
stonechoe committed Feb 5, 2024
1 parent b2dba12 commit 96da3a4
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions packages/core-js/internals/array-reduce.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var createMethod = function (IS_RIGHT) {
var self = IndexedObject(O);
var length = lengthOfArrayLike(O);
aCallable(callbackfn);
if (length === 0 && argumentsLength < 2) throw new $TypeError('Reduce of empty array with no initial value');
var index = IS_RIGHT ? length - 1 : 0;
var i = IS_RIGHT ? -1 : 1;
if (argumentsLength < 2) while (true) {
Expand Down

0 comments on commit 96da3a4

Please sign in to comment.