Javascript Tutorial 21 – How to sort arrays




Here we look at sorting our arrays. We sort them in an alphabetical fashion, ascending numerically and descending numerically.

Become an awesome software developer!
http://anthonyvipond.com/training

Add me on LinkedIn
https://www.linkedin.com/in/anthony1981

Email: anthonytrading81 @ gmail

Original source


12 responses to “Javascript Tutorial 21 – How to sort arrays”

  1. I assume youre talking about the sorting array numerically. It was hard for me before too. In the end theres not much to think about, the sort method was designed to take a comparison function as an argument and the interpreter will execute it in its own way. But you can think of the function being running on all the array elements going from left to right, over and over again until its done. Anytime a – b returns a positive number the first operand (a) goes to the right, b goes to the left

Leave a Reply