Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const chars = 'QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890'.split('');
- const codeLength = 7;
- const generator = () => {
- const code = [];
- for (let i = 0; i < codeLength; i++) code.push(Math.floor(Math.random() * chars.length));
- return code.join('');
- }
- const code = generator();
- console.log(code);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement