Skip to content

Instantly share code, notes, and snippets.

@garvin
Created March 31, 2016 21:44
Show Gist options
  • Save garvin/0266789815689e2b81c931f8113b0eec to your computer and use it in GitHub Desktop.
Save garvin/0266789815689e2b81c931f8113b0eec to your computer and use it in GitHub Desktop.
Quick & dirty unique ID generator
/**
* Creates a string that can be used for dynamic id attributes
* Example: "id-so7567s1pcpojemi"
* @returns {string}
*/
var uniqueId = function() {
return 'id-' + Math.random().toString(36).substr(2, 16);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment