Skip to content

Instantly share code, notes, and snippets.

@jezinka

jezinka/day4.js Secret

Created June 16, 2017 08:03
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 jezinka/b7f348f36ed98318500b72503676f902 to your computer and use it in GitHub Desktop.
Save jezinka/b7f348f36ed98318500b72503676f902 to your computer and use it in GitHub Desktop.
sorting if equals
return a.sort(function (a, b) {
if (o[b] !== o[a]) {
return o[b] - o[a];
}
return a.charCodeAt(0) - b.charCodeAt(0);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment