Skip to content

Instantly share code, notes, and snippets.

@etc-tiago
Created July 3, 2020 13:01
Show Gist options
  • Save etc-tiago/61fa641da16f2f366f5583f67e0bc0eb to your computer and use it in GitHub Desktop.
Save etc-tiago/61fa641da16f2f366f5583f67e0bc0eb to your computer and use it in GitHub Desktop.
var ID = function () {
// Math.random should be unique because of its seeding algorithm.
// Convert it to base 36 (numbers + letters), and grab the first 9 characters
// after the decimal.
const start = Math.random().toString(36).substr(2, 2);
const end = Math.random().toString(36).substr(2, 2);
return '_' + start + end;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment