Ancestors

Toot

Written by westbrook on 2025-01-05 at 18:40

How cool is that...amirite?

['a', 'a 20', 'a 1', 'a 2', 'a 12'].sort((a,b) => ("" + a).localeCompare(b, undefined, {numeric: true}));

['a', 'a 1', 'a 2', 'a 12', 'a 20']

NOT

['a', 'a 1', 'a 12', 'a 2', 'a 20']

😎

=> More informations about this toot | More toots from westbrook@mastodon.social

Descendants

Written by Jeremia Kimelman on 2025-01-05 at 19:26

@westbrook That is cool! Had no idea about localeCompare!!

=> More informations about this toot | More toots from jeremiak@journa.host

Written by westbrook on 2025-01-05 at 20:23

@jeremiak I'd been using it without the {numeric: true}, and had no idea what I was missing. The web platform...huge!

=> More informations about this toot | More toots from westbrook@mastodon.social

Written by Jeremia Kimelman on 2025-01-05 at 20:38

@westbrook Totally! I feel like I'm learning about a new API nearly every week. The { numeric: true } thing is the KEY!

=> More informations about this toot | More toots from jeremiak@journa.host

Proxy Information
Original URL
gemini://mastogem.picasoft.net/thread/113777209163134070
Status Code
Success (20)
Meta
text/gemini
Capsule Response Time
253.542531 milliseconds
Gemini-to-HTML Time
0.951896 milliseconds

This content has been proxied by September (3851b).