Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js sort array

// ascending (normal)
numArray.sort((a,b) => a-b);

// decending (reverse)
numArray.sort((a,b) => b-a);
Source by developer.mozilla.org #
 
PREVIOUS NEXT
Tagged: #js #sort #array
ADD COMMENT
Topic
Name
7+9 =