1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

JavaScriptでUUID4を実現させる

Posted at

タイトルのまま[JavaScriptでUUID4を実現させる]

参照先:JavaScript で UUID (Ver4)

こちらを参考にminifyしました。

function uuid4(){for(var x="xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".split(""),t=0,o=x.length;t<o;t++)switch(x[t]){case"x":x[t]=Math.floor(16*Math.random()).toString(16);break;case"y":x[t]=(Math.floor(4*Math.random())+8).toString(16)}return x.join("")}

以上です。

1
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?