javascript sort array of ints
function sortNumbers(a, b) {
return a - b;
}
var ages = [12, 95, 43, 15, 10, 32, 65, 78, 8];
ages.sort(sortNumbers); //ages is now sorted low to high
//console.log(ages); [8, 10, 12, 15, 32, 43, 65, 78, 95]
Also in JavaScript:
- next js newsletter
- problem solving for loop in javascript
- js read a ini file
- javascript date now
- js switch
- add javascript keyup on input
- duplicate encoder
- convert number to indian rupee format in javascript
- javascript time execution
- fetch api react
- javascript set local storage value
- javascript append list
- How to abreviate digits in js
- Should I learn Javascript?
- discord.js find role by name
- how to verify timestamp format in javascript
- Javascript check if undefined
- aes 256 nodejs
- FizzBuzz
- $('#mymodal').modal('show') not working
- page is loading from previous page scroll in reactjs
- javascript print object pretty
- vue js Elements in iteration expect to have 'v-bind:key' directives
- strapi cloudinary how to use