Skip to content

Instantly share code, notes, and snippets.

@katepapineni
Created August 1, 2020 17:09
Show Gist options
  • Save katepapineni/d3a14361fab48d40ac1cfe9aa4f93518 to your computer and use it in GitHub Desktop.
Save katepapineni/d3a14361fab48d40ac1cfe9aa4f93518 to your computer and use it in GitHub Desktop.
const numbers = [3, 11, 29, 19, 7];
const sort1 = (a, b) => a - b;
const sort2 = (a, b) => b - a;
// What's the output ?
console.log(numbers.sort(sort1));
console.log(numbers.sort(sort2));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment