Skip to content

Instantly share code, notes, and snippets.

@esutton
Last active October 2, 2020 14:40
Show Gist options
  • Save esutton/73f00528ee4e4fcc481924ac92207c16 to your computer and use it in GitHub Desktop.
Save esutton/73f00528ee4e4fcc481924ac92207c16 to your computer and use it in GitHub Desktop.
ES6 sort object array by key name
arrayList.sort((a, b) => {
const textA = a.name.toUpperCase();
const textB = b.name.toUpperCase();
return (textA < textB) ? -1 : (textA > textB) ? 1 : 0;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment