JS Built-ins
TypedArrayfromintermediate

Int32Array.from() with Array-Like Object

πŸ“– Usage Example
const arr = Int32Array.from({ length: 3, 0: 10, 1: 20, 2: 30 });
// Int32Array [10, 20, 30]

Array-like objects with a length property work with TypedArray.from().

Create a typed array from an array-like object with a length property using a map function.

πŸ’‘ Hints (1)
  • β€’ Use Int32Array.from({length: n}, (_, i) => i * 10)