+5

How this function works???

How this takes value of a, b? How this works var a = [33, 4, 1111, 222]; a.sort(); // Alphabetical order: 1111, 222, 33, 4 a.sort(function(a,b) { return a-b; }); a.sort(function(a,b) {return b-a});

1/12/2019 2:32:06 PM

Prabhat Kumar Singh

2 Answers

New Answer

+4

https://www.w3schools.com/js/js_array_sort.asp

+1

Thank you so much Ulisses Cruz