JavaScript Int8Array of() Method Last Updated : 13 Dec, 2022 Summarize Comments Improve Suggest changes Share Like Article Like Report 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: This method accepts the number of elements, which are basically the elements for which the array is created. Return Value: This method returns a new Int8Array instance. Example 1: In this example, the values passed are the character values that are converted to Int8 by the method. HTML <script> // Create a Int8Array from a array // by creating the array from the // Int8Array.of() method let int8Arr = new Int8Array; int8Arr = Int8Array.of('1', '5', '2', '8', '14'); // Print the result console.log(int8Arr); </script> Output: [1, 5, 2, 8, 14] Example 2: In this example, the values passed are the integer values which are converted to Int8 by the method. 49999 and 799 are converted to 79 and 31 respectively. JavaScript <script> // Create a Int8Array from a array // by creating the array from the // Int8Array.of() method let int8Arr = new Int8Array; // Accepts the int8 values int8Arr = Int8Array.of(49999, 5, 6, 799, 8); // Print the result console.log(int8Arr); </script> Output: [79, 5, 6, 31, 8] Comment More infoAdvertise with us Next Article JavaScript TypedArray.of() Method P PranchalKatiyar Follow Improve Article Tags : JavaScript Web Technologies javascript-array JavaScript-Methods Similar Reads 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 JavaScript Int16Array from() Method The Int16Array array represents an array of twos-complement of 16-bit signed integers. By default, the contents of Int16Array are initialized to 0. The Int16Array.from() function is used to create a new Int16Array from an array-like or iterable object. So when you want to convert an arrayLike or ite 2 min read JavaScript Uint8Array.of() Method 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 argum 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 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 Like