Created
January 19, 2015 06:24
-
-
Save tangyangzhe/8ce7bcddb90104aee5c0 to your computer and use it in GitHub Desktop.
JS生成GUID
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var guid = function() { | |
var S4 = function() { | |
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1); | |
}; | |
return (S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4()); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment