Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function crearOTP() {
- const caracteres = '0123456789abcdefghijklmnopqrstuvwxyz';
- let otp = "";
- for (let i = 6; i > 0; i--) {
- otp += caracteres[Math.floor(Math.random() * caracteres.length)];
- }
- return otp;
- }
- crearOTP();
- // Output (Resultado)
- 'random OTP'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement