Premium

Sort Numbers with Array.prototype.sort

By FrontendAtlas Editorial · Updated Feb 1, 2026

Challenge summary

Sort numeric values in either direction while leaving the source array unchanged.

What you'll practice

  • Use numeric comparison rather than default string ordering.
  • Support both ascending and descending order explicitly.
  • Return a new array without mutating the input.

What Premium unlocks

Premium unlocks the runnable workspace, behavioral checks, implementation walkthrough, and edge-case discussion.

Free related practice

Upgrade to FrontendAtlas Premium to unlock this challenge. Already upgraded? Sign in to continue.