Thursday, July 4, 2024
HomeLanguagesJavascriptJavaScript typedArray.of() Method

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: It returns the new typedArray instance. 

Example :

javascript




// Printing the new typedArray with the given elements with
// the parameters of typedArray.of() function.
console.log(Uint8Array.of(5, 9, 1, 0, 45, 2));
console.log(Uint8Array.of(22, 9, 1, 20));
console.log(Uint8Array.of(5, 9, 0, 3, 1));
console.log(Uint8Array.of(undefined));


Output:

5, 9, 1, 0, 45, 2
22, 9, 1, 20
5, 9, 0, 3, 1
0
Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!

Dominic Rubhabha Wardslaus
Dominic Rubhabha Wardslaushttps://neveropen.dev
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Most Popular

Recent Comments