Sort array by firstname (alphabetically) in Javascript
Suppose you have an array users. You may use users.sort and pass a function that takes two arguments and compare them (comparator) It should return something negative if first argument is less than second (should be placed before the second in resulting array) something positive if first argument is greater (should be placed after second one) 0 if … Read more