Skip to content

Instantly share code, notes, and snippets.

@wondger
Created May 3, 2012 16:49
Show Gist options
  • Save wondger/2587166 to your computer and use it in GitHub Desktop.
Save wondger/2587166 to your computer and use it in GitHub Desktop.
GUID by JavaScript
var guid = (function(){
function S4(){return(((1+Math.random())*65536)|0).toString(16).substring(1)}
return function guid(){return(S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4()).toUpperCase()}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment