How to get purely unique number in javascript

This question already has an answer here:

  • Create GUID / UUID in JavaScript? 49 answers

  • You can create a UUID:

    function guid() {
      function s4() {
        return Math.floor((1 + Math.random()) * 0x10000)
          .toString(16)
          .substring(1);
      }
      return s4() + s4() + '-' + s4() + '-' + s4() + '-' +
        s4() + '-' + s4() + s4() + s4();
    }
    

    Original answer: https://stackoverflow.com/a/105074/5109911

    alternative: https://jsfiddle.net/briguy37/2MVFd/

    链接地址: http://www.djcxy.com/p/16248.html

    上一篇: 如何在没有提交表单的情况下在php ajax中生成唯一标识

    下一篇: 如何在javascript中获得纯粹唯一的数字