Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

generate otp using javascript

function generateOTP() {
          
    // Declare a digits variable 
    // which stores all digits
    var digits = '0123456789';
    let OTP = '';
    for (let i = 0; i < 4; i++ ) {
        OTP += digits[Math.floor(Math.random() * 10)];
    }
    return OTP;
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: jquery scroll to specific div 
Javascript :: image source react native 
Javascript :: angular pipe first letter uppercase 
Javascript :: css in console.log 
Javascript :: jquery body class add 
Javascript :: jquery if class exists 
Javascript :: electron hide top bar 
Javascript :: sort array of object js 
Javascript :: run react native app in production mode 
Javascript :: required false jquery 
Javascript :: javascript remove parentheses 
Javascript :: logout in react js 
Javascript :: js key is pressed 
Javascript :: Appium press Enter on android with js 
Javascript :: create react app netlify 
Javascript :: Could not find com.yqritc:android-scalablevideoview:1.0.4 react native video 
Javascript :: javascript detect ios device 
Javascript :: align text into center of container react native 
Javascript :: reduce average javascript 
Javascript :: connect mongoose to atlas 
Javascript :: creating new react app 
Javascript :: json server sorting 
Javascript :: how to play jquery audio 
Javascript :: how to add a right click listener javascript 
Javascript :: how to check wether the property exist in a object in java script 
Javascript :: jquery form serialized data 
Javascript :: Manifest 3 content security policy 
Javascript :: check if array javascript 
Javascript :: adding event on keypress in javascript 
Javascript :: jquery get all checked checkboxes 
ADD CONTENT
Topic
Content
Source link
Name
4+2 =