๐ข Quick tip: if you're sorting an array in JS and keep forgetting how to write the compare functions (like I do), here's a mnemonic device:
(a, z) => a - z // ascending, like "a to z"
(a, z) => z - a // descending, like "z to a"
Hope this helps someone!