Skip to main content

JS Code for Generating OTP

JS Code for Generating OTP - 

* Learn how to create a simple JavaScript function to generate a random 4-digit OTP.

JS Code for Generating OTP
(GENERATED BY - ChatGPT)


function OTP() {
    let otp = "";
    otp = Math.floor(Math.random() * 9000 + 1000);
    return otp;
}
console.log("Your OTP is-", OTP());

Comments