当前位置:首页 > 编程技术 > 正文

js如何生成唯一的数据

js如何生成唯一的数据

1. 使用时间戳```javascriptfunction generateUniqueData( { return 'xxxxxxxx-xxxx-4xxx-yxxx...

1. 使用时间戳

```javascript

function generateUniqueData() {

return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {

var r = (Math.random() 16) 0;

var v = c === 'x' ? r : (r & 0x3) 0x8;

return v.toString(16);

最新文章