Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

JavaScript | typedArray.of() with Examples

  • Last Updated : 03 Aug, 2018

The typedArray.of() is an inbuilt function in JavaScript which is used to construct a new typedArray with a variable number of parameters.

TypedArray.of(element0, element1, ......)

Parameters: It accepts parameters of different elements whose typedArray is going to be created.

Hey geek! The constant emerging technologies in the world of web development always keeps the excitement for this subject through the roof. But before you tackle the big projects, we suggest you start by learning the basics. Kickstart your web development journey by learning JS concepts with our JavaScript Course. Now at it's lowest price ever!

Return value: It returns the new typedArray instance.

JavaScript code to show the working of this function:

    // Printing the new typedArray with the given elements with
    // the parameters of typedArray.of() function.
    document.write(Uint8Array.of(5, 9, 1, 0, 45, 2) + "<br>");
    document.write(Uint8Array.of(22, 9, 1, 20) + "<br>");
    document.write(Uint8Array.of(5, 9, 0, 3, 1) + "<br>");
    document.write(Uint8Array.of(undefined) + "<br>");


5, 9, 1, 0, 45, 2
22, 9, 1, 20
5, 9, 0, 3, 1
My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!