Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

Sort numbers from an array in javascript

const bignumbers = [66, 58, 81, 444, 92, 9, 6, 13, 2];
const sortedNumbers = bignumbers.sort(function (a, b) {
    return a - b;
})
console.log(sortedNumbers);
//Output: [2, 6, 9, 13, 58,66, 81, 92, 444]
 
PREVIOUS NEXT
Tagged: #Sort #numbers #array #javascript
ADD COMMENT
Topic
Name
9+7 =