JavaScript Uint8Array.of() Method Last Updated : 10 Jan, 2023 Comments Improve Suggest changes Like Article Like Report The Uint8Array array represents an array of 8-bit unsigned integers. The values are initialized by 0. Elements in the array can be referenced by the object's methods or using a standard syntax (by bracket notation). The Uint8Array.of() method creates a new typed array from a variable number of arguments. Syntax: Uint8Array.of(el0, el1, el2, .., eln) Parameters: n-elements: This method accepts the number of elements, which are basically the element for which the array is to be created. Return Value: This method returns a new Uint8Array instance. Example 1: In this example, the values passed are the character values that are converted to Uint8 by the method. JavaScript <script> // Creating a Uint8Array from a array by // Creating the array from the Uint8Array.of() method let uint8Arr = new Uint8Array; uint8Arr = Uint8Array.of('41', '51', '56', '8', '24'); // Printing the result console.log(uint8Arr); </script> Output: Uint8Array(5) [41, 51, 56, 8, 24] Example 2: In this example, the values passed are the int values that are converted to Uint8 by the method. -49999 and 799 converted to 177 and 31 respectively. JavaScript <script> // Create a Uint8Array from a array by // Creating the array from the Uint8Array.of() method let uint8Arr = new Uint8Array; // Accepts the uint8 values uint8Arr = Uint8Array.of(-49999, 5, 7, 799, 8); // Print the result console.log(uint8Arr); </script> Output: Uint8Array(5) [177, 5, 7, 31, 8] Supported Browsers: ChromeEdgeFirefoxOperaSafari Comment More infoAdvertise with us Next Article JavaScript Uint8Array.of() Method P PranchalKatiyar Follow Improve Article Tags : JavaScript Web Technologies JavaScript-Methods Similar Reads JavaScript Uint8ClampedArray.of() Method The Javascript Uint8ClampedArray array is an array of 8-bit unsigned integers clamped to 0-255. If the value passed is less than 0 or larger than 255 then it will be set instead. If a non-integer is specified, the nearest integer will be set. The Uint8ClampedArray.of() method creates a new typed arr 2 min read JavaScript Uint8Array.from() Method The Uint8Array.from() method in JavaScript is used to create a new Uint8Array from an array-like or iterable object. It allows you to transform an existing array or iterable into a new Uint8Array instance, where each element of the new array is represented as an 8-bit unsigned integer. Syntax: Uint8 2 min read JavaScript TypedArray.of() Method The TypedArray.of() method is used to create a new array from a variable number of arguments that are passed to it. Syntax: TypedArray.of( el0, el1, el2, ...elN ) Parameters: This method accepts a variable number of elements, which are used to create the Int16Array array. TypedArray can contain any 2 min read JavaScript typedArray.of() Method The typedArray.of() is an inbuilt function in JavaScript which is used to construct a new typedArray with a variable number of parameters. Syntax: TypedArray.of(element0, element1, ......) Parameters: It accepts parameters of different elements whose typedArray is going to be created. Return value: 1 min read JavaScript Uint32Array from() Method The Javascript Uint32Array array represents an array of 32-bit unsigned integers in the platform byte order. By default, the contents of Uint32Array are initialized to 0. The from() function of Uint32Array is used to create a new Uint32Array from an array-like or iterable object. So when you want to 2 min read JavaScript Unit16Array.from() Method The Javascript Uint16Array represents an array of 16-bit unsigned integers in the platform byte order. By default, the contents of Uint16Array are initialized to 0. The Uint16Array.from() function is used to create a new Uint16Array from an array-like or iterable object. So when you want to convert 2 min read JavaScript Uint8ClampedArray.from() Method The Uint8ClampedArray represents an array of 8-bit unsigned integers clamped to 0-255. If a value is specified that is not in the range of [0, 255], 0, or 255 will be set instead; if the specified value is not an integer, the nearest integer will be set. By default, the contents of Uint8ClampedArray 2 min read JavaScript typedArray.indexOf() Method The typedArray.indexOf() is an inbuilt function in JavaScript which is used to return the index of the element if found in the given typedArray otherwise it returns -1. Syntax: typedarray.indexOf(Element, Index); Parameters: It accepts two parameter which are specified below- Element: It is the elem 2 min read JavaScript Int8Array of() Method The Int8Array constructor represents an array of two's-complement of 8-bit signed integers. By default, the contents of Int8Array are initialized to 0. The Int8Array.of() method is used to create a new Int8Array from an array-like or iterable object. Syntax: Int8Array.of(el0, el1, ...) Parameter: Th 2 min read JavaScript Int8Array from() Method The Javascript Int8Array represents an array of twos-complement of 8-bit signed integers. By default, the contents of Int8Array are initialized to 0. from the () function of Int8Array used to create a new Int8Array from an array-like or iterable object. So when you want to convert an arrayLike or it 2 min read Like