Generate OTP using javascript

Vanilla Javascript to generate OTP and print in the console.

function generateOTP(){

    var digits = '0123456789abcdefghijklmnopqrstuvwxyz';

    var otpLength = 6;

    var otp = '';

    for(let i=1; i<=otpLength; i++){

        var index = Math.floor(Math.random()*(digits.length));

        otp = otp + digits[index];

    }

    return otp;

}

console.log(generateOTP());