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