Thursday, January 22, 2026
HomeLanguagesJavascriptJavaScript typedArray.reverse() Method

JavaScript typedArray.reverse() Method

The typedArray.reverse() is an inbuilt function in JavaScript which is used to reverse the given typedArray elements i.e, first element becomes the last and vice versa. 

Syntax:

typedArray.reverse();

Parameter: It does not accept any parameters. Return value: It returns the new reversed typedArray. 

Example:

javascript




// Creating some typedArrays with some elements
const A = new Uint8Array([ 1, 2, 3, 4, 5, 6 ]);
const B = new Uint8Array([ 5, 10, 15, 20 ]);
const C = new Uint8Array([ 2, 4, 6, 8, 10 ]);
const D = new Uint8Array([ 1, 3, 5, 7 ]);
const E = new Uint8Array();
  
// Calling reverse() function on the above typedArray
a = A.reverse();
b = B.reverse();
c = C.reverse();
d = D.reverse();
e = E.reverse();
  
// Printing the reversed typedArray
console.log(a);
console.log(b);
console.log(c);
console.log(d);
console.log(e);


Output:

6, 5, 4, 3, 2, 1
20, 15, 10, 5
10, 8, 6, 4, 2
7, 5, 3, 1
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!
RELATED ARTICLES

Most Popular

Dominic
32475 POSTS0 COMMENTS
Milvus
119 POSTS0 COMMENTS
Nango Kala
6847 POSTS0 COMMENTS
Nicole Veronica
11977 POSTS0 COMMENTS
Nokonwaba Nkukhwana
12064 POSTS0 COMMENTS
Shaida Kate Naidoo
6986 POSTS0 COMMENTS
Ted Musemwa
7220 POSTS0 COMMENTS
Thapelo Manthata
6933 POSTS0 COMMENTS
Umr Jansen
6912 POSTS0 COMMENTS