Skip to content

Instantly share code, notes, and snippets.

@ancyrweb
Created January 12, 2022 13:37
Show Gist options
  • Select an option

  • Save ancyrweb/0499fd2c0dc10740e8aad3a7b35f83d8 to your computer and use it in GitHub Desktop.

Select an option

Save ancyrweb/0499fd2c0dc10740e8aad3a7b35f83d8 to your computer and use it in GitHub Desktop.
const elements = [1, 6, 4, 5, 2, 3];
const byOrderAsc = (a, b) => a - b;
const nextElements = elements.slice().sort(byOrderAsc); // [1, 2, 3, 4, 5, 6]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment