1 // Copyright (C) 2024 André Bargull. All rights reserved.
2 // This code is governed by the BSD license found in the LICENSE file.
5 esid: sec-%typedarray%.from
7 Modifications to input array after iteration are handled correctly.
9 %TypedArray%.from ( source [ , mapfn [ , thisArg ] ] )
12 6. If usingIterator is not undefined, then
13 a. Let values be ? IteratorToList(? GetIteratorFromMethod(source, usingIterator)).
14 b. Let len be the number of elements in values.
16 e. Repeat, while k < len,
18 vi. Perform ? Set(targetObj, Pk, mappedValue, true).
20 features: [TypedArray]
25 // Removes all array elements. Caller must have saved all elements.
31 // `from` called with array which uses the built-in array iterator.
32 let ta = Int32Array.from(values);
34 assert.sameValue(ta.length, 3);
35 assert.sameValue(ta[0], 0);
36 assert.sameValue(ta[1], 100);
37 assert.sameValue(ta[2], 2);