Javascript Uint32Array of()

Introduction

The Uint32Array.of() method creates a new typed array from a variable number of arguments.

This method works the same as Array.of().

Uint32Array.of(element0[, element1[, ...[, elementN]]])
Parameter Optional Meaning
elementN RequiredElements of which to create the typed array.
let a = Uint32Array.of(1);            // Uint32Array [ 1 ]
console.log(a);/*from   ww  w .j  a  v a2  s. com*/
a = Uint32Array.of('1', '2', '3'); // Uint32Array [ 1, 2, 3 ]
console.log(a);
a = Uint32Array.of(1, 2, 3);    // Uint32Array [ 1, 2, 3 ]
console.log(a);
a = Uint32Array.of(undefined);    // Uint32Array [ 0 ]
console.log(a);



PreviousNext

Related