Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

sort() function example JavaScript

function ascendingOrder(arr) {
  return arr.sort(function(a, b) {
    return a - b;
  });
}
ascendingOrder([1, 5, 2, 3, 4]);
Source by www.freecodecamp.org #
 
PREVIOUS NEXT
Tagged: #function #JavaScript
ADD COMMENT
Topic
Name
4+5 =