Skip to content

Instantly share code, notes, and snippets.

@rameshbaskar
Created January 31, 2023 08:37
Show Gist options
  • Save rameshbaskar/a0b5fcaa11d5c64c04219be55a58e991 to your computer and use it in GitHub Desktop.
Save rameshbaskar/a0b5fcaa11d5c64c04219be55a58e991 to your computer and use it in GitHub Desktop.
Simple array sorting in Javascript
function sortArray(arr) {
return arr.sort((a, b) => a - b);
}
const arr = [3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5];
console.log(sortArray(arr));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment