Skip to content

Instantly share code, notes, and snippets.

@gabri83
Created August 13, 2025 08:11
Show Gist options
  • Select an option

  • Save gabri83/096f2c03580f6c2d8a6f06dc7decd202 to your computer and use it in GitHub Desktop.

Select an option

Save gabri83/096f2c03580f6c2d8a6f06dc7decd202 to your computer and use it in GitHub Desktop.
Sorting an Array of Numbers (JavaScript)
const numbers = [5, 2, 9, 1];
numbers.sort((a, b) => a - b);
console.log(numbers); // [1, 2, 5, 9]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment