Last active
May 17, 2023 04:37
-
-
Save lzehrung/d0092c99c37a733e338544083eb3f811 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const alpha = 'abcdef'.toUpperCase().split(''); | |
| const randomNumber = () => Math.floor(Math.random() * 10).toString(); | |
| const randomLetter = () => alpha[Math.floor(Math.random() * alpha.length)]; | |
| const randomCharacter = () => Math.random() > 0.5 ? randomLetter() : randomNumber(); | |
| function generateOtp(length = 6) { | |
| return Array.from({ length }, randomCharacter).join(''); | |
| } | |
| const pass = generateOtp(); | |
| console.log('%c' + pass, `background: #${pass}; color: black`); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment