The Int32Array.of()
method creates a new typed array from a variable number of arguments.
This method works the same as Array.of()
.
Int32Array.of(element0[, element1[, ...[, elementN]]])
Parameter | Optional | Meaning |
---|---|---|
elementN | Required | Elements of which to create the typed array. |
let a = Int32Array.of(1); // Int32Array [ 1 ] console.log(a);//w w w . j a v a 2 s. co m a = Int32Array.of('1', '2', '3'); // Int32Array [ 1, 2, 3 ] console.log(a); a = Int32Array.of(1, 2, 3); // Int32Array [ 1, 2, 3 ] console.log(a); a = Int32Array.of(undefined); // Int32Array [ 0 ] console.log(a);