Swathi Prasad
1 min readAug 13, 2019

--

Thanks, you are right. I wrote that output because I did the following:

let arraySort = [‘India’, ‘Germany’, ‘China’, ‘Japan’];

console.log(arraySort.sort()); //[“China”, “Germany”, “India”, “Japan”]

//Reverse function
console.log(arraySort.reverse()); //[“Japan”, “India”, “Germany”, “China”]

Notice the variable usage. This would give me result as [“Japan”, “India”, “Germany”, “China”] for reverse().

--

--

Swathi Prasad
Swathi Prasad

Written by Swathi Prasad

Software architect and developer living in Germany. Sharing my opinion and what I learn.

No responses yet