From afb097d49dfc205568a36f526c1c2e27b1040a11 Mon Sep 17 00:00:00 2001 From: Minseok Choe Date: Fri, 23 Feb 2024 13:47:04 +0900 Subject: [PATCH] edit array-from.js --- packages/core-js/internals/array-from.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/core-js/internals/array-from.js b/packages/core-js/internals/array-from.js index 323b18328605..e187939e8b53 100644 --- a/packages/core-js/internals/array-from.js +++ b/packages/core-js/internals/array-from.js @@ -26,9 +26,9 @@ module.exports = function from(arrayLike /* , mapfn = undefined, thisArg = undef var length, result, step, iterator, next, value; // if the target is not iterable or it's an array with the default iterator - use a simple case if (iteratorMethod && !(this === $Array && isArrayIteratorMethod(iteratorMethod))) { + result = IS_CONSTRUCTOR ? new this() : []; iterator = getIterator(O, iteratorMethod); next = iterator.next; - result = IS_CONSTRUCTOR ? new this() : []; for (;!(step = call(next, iterator)).done; index++) { value = mapping ? callWithSafeIterationClosing(iterator, mapfn, [step.value, index], true) : step.value; createProperty(result, index, value);