1function generateOTP() {
2
3 // Declare a digits variable
4 // which stores all digits
5 var digits = '0123456789';
6 let OTP = '';
7 for (let i = 0; i < 4; i++ ) {
8 OTP += digits[Math.floor(Math.random() * 10)];
9 }
10 return OTP;
11}