唯一数
作者:互联网
function genUuid(length) {
const random = Date.now().toString(36);
if (random.length > length) {
return random.substr().substr(random.length - length, length);
} else if (random.length < length) {
return Array(length - random.length).fill('').map(() => Math.ceil(Math.random() * 35).toString(36)).join('') + random;
}
return random;
}
标签:return,random,36,唯一,substr,length,toString 来源: https://www.cnblogs.com/0520euv/p/15812167.html