Nov 1, 2018

JavaScript Sorting

JavaScript has a built-in sorting method. It works on arrays of numbers, or even on arrays of strings:

var animals = ["gnu", "zebra", "antelope", "aardvark", "yak", "iguana"]; animals.sort(); println(animals);