Skip to content

Instantly share code, notes, and snippets.

@jmas
Last active March 20, 2024 07:21
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 jmas/220dfd1a8aff64f977cfd6c1e889d6d9 to your computer and use it in GitHub Desktop.
Save jmas/220dfd1a8aff64f977cfd6c1e889d6d9 to your computer and use it in GitHub Desktop.
uniqid.js
/**
* If IDs are generated more than 1 millisecond apart, they are 100% unique.
* @url https://stackoverflow.com/a/44078785
* @returns String
*/
function uniqid() {
return Date.now().toString(36) + Math.random().toString(36).substring(2);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment