- Assert: length is an integer Number ≥ 0.
- If length is -0, let length be +0.
- Let isArray be ? IsArray(originalArray).
- If isArray is false, return ? ArrayCreate(length).
- Let C be ? Get(originalArray,
"constructor"
). - If IsConstructor(C) is true, then
- Let thisRealm be the current Realm Record.
- Let realmC be ? GetFunctionRealm(C).
- If thisRealm and realmC are not the same Realm Record, then
- If SameValue(C, realmC.[[Intrinsics]].[[%Array%]]) is true, let C be undefined.
- If Type(C) is Object, then
- Let C be ? Get(C, @@species).
- If C is null, let C be undefined.
- If C is undefined, return ? ArrayCreate(length).
- If IsConstructor(C) is false, throw a TypeError exception.
- Return ? Construct(C, « length »).
Created
April 24, 2016 10:48
-
-
Save evilpie/d02f4b7c20ca2c393b88c64d7ce76c44 to your computer and use it in GitHub Desktop.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment