Skip to content

Instantly share code, notes, and snippets.

@lumio
lumio / sorting-done-right.js
Last active March 21, 2018 19:40
Sorting done right
const localeCompare = ( a, b ) => a.localeCompare( b, 'de' );
const fruits = [ 'Äpfel', 'Ananas', 'Birnen' ].sort( localeCompare );
console.log( fruits ); // [ 'Ananas', 'Äpfel', 'Birnen' ]
@lumio
lumio / sorting-done-wrong.js
Created March 21, 2018 19:24
Sorting done wrong
const fruits = [ 'Äpfel', 'Ananas', 'Birnen' ].sort();
console.log( fruits ); // [ 'Ananas', 'Birnen', 'Äpfel' ]

Keybase proof

I hereby claim:

  • I am lumio on github.
  • I am lumio (https://keybase.io/lumio) on keybase.
  • I have a public key ASDl4FkX1ZhXp_jQ1ETk3qSQj0CXgLNWwkJ2B3wQ_vU7rgo

To claim this, I am signing this object: