Skip to content

Instantly share code, notes, and snippets.

@kenmueller
Last active May 31, 2019 02:55
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 kenmueller/6174a220b6ea8bf2dd1aef372e03756d to your computer and use it in GitHub Desktop.
Save kenmueller/6174a220b6ea8bf2dd1aef372e03756d to your computer and use it in GitHub Desktop.
Creates a random ID with a specified length
const newId = length =>
[...Array(length)].map(_i => (~~(Math.random() * 36)).toString(36)).join('')
function newId(length) {
return [...Array(length)].map(_i => (~~(Math.random() * 36)).toString(36)).join('')
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment