Skip to content

Commit

Permalink
feat(OTP): generate one time password
Browse files Browse the repository at this point in the history
  • Loading branch information
Ellipse120 committed Sep 22, 2023
1 parent 81fef83 commit 8f13b1c
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions note.md
Original file line number Diff line number Diff line change
Expand Up @@ -4472,3 +4472,22 @@ const copyTextContent = createCopyTextContent()
```
---
## 159. Generate one-time password(`OTP`)
```js
const generateOTP = () => {
const digits = '0123456789'
let otp = ''

for (let i = 0; i < 6; i++) {
otp += digits[Math.floor(Math.random() * 10)]
}

return otp
}

generateOTP()
```
---

0 comments on commit 8f13b1c

Please sign in to comment.