Create a unique number with javascript time

后端 未结 30 3158
生来不讨喜
生来不讨喜 2020-12-02 08:31

I need to generate unique id numbers on the fly using javascript. In the past, I\'ve done this by creating a number using time. The number would be made up of the four digi

30条回答
  •  醉酒成梦
    2020-12-02 08:38

    I have done this way

    function uniqeId() {
       var ranDom = Math.floor(new Date().valueOf() * Math.random())
       return _.uniqueId(ranDom);
    }
    

提交回复
热议问题