Skip to content

Instantly share code, notes, and snippets.

@jsrath
Last active November 3, 2018 15:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jsrath/b55e8f23bb7c44f34dfab7dafa33499c to your computer and use it in GitHub Desktop.
Save jsrath/b55e8f23bb7c44f34dfab7dafa33499c to your computer and use it in GitHub Desktop.
sortLetters() {
this.dataService.contacts[0].forEach(contact => {
this.letters.push(contact.name.toUpperCase().slice(0, 1));
});
this.letters = this.letters.filter( (elem, index, self) => index === self.indexOf(elem));
}
sortContacts() {
this.dataService.contacts[0] = this.dataService.contacts[0].sort((a, b) => a.name.localeCompare(b.name))
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment