10 lines
298 B
TypeScript
10 lines
298 B
TypeScript
|
|
export function genCode(len) {
|
|
const chars = '123456789ABCDEFGHJKLMNPQRSTWXYZabcdefghijklmnopqrstuvwxyz';
|
|
const charArr = chars.split('');
|
|
let code = '';
|
|
for (let i = 0; i < len; i++) {
|
|
code += charArr[Math.floor(Math.random() * charArr.length)];
|
|
}
|
|
return code;
|
|
} |