Skip to content

Instantly share code, notes, and snippets.

@hebertcisco
Created March 25, 2022 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hebertcisco/3bb189f128d7b2cf6a4563f039c501b3 to your computer and use it in GitHub Desktop.
Save hebertcisco/3bb189f128d7b2cf6a4563f039c501b3 to your computer and use it in GitHub Desktop.
Number ordering in JavaScript not working? Solved.
const seq = [11, 12, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1];
function sortNumbers(arrayOfNumbers: number[]) {
return arrayOfNumbers.sort((x, y) => x - y);
}
sortNumbers(seq);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment