Skip to content

Instantly share code, notes, and snippets.

@c0derabbit c0derabbit/unique_id.js

Last active Sep 30, 2017
What would you like to do?
Creates a unique ID in JavaScript
const id = + Math.random().toString(16).substr(2);


Returns a unique alphanumeric ID given that it uses and a random string.


Create and use the id any time.

var yourNewId =;
var yourOtherNewId =;

yourNewId and yourOtherNewId will look something like this, but of course, both completely unique: "146849867772717a4cb2f"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.