Creating one time password (OTP) and view on SL3

Nov 23, 2019

Hi there,

I have went online to download the following code for creating OTP

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;


I'm not very good at javascripts….I want to view the OTP on the slide with %NewOTP%...but I  can't seem to be able to. Below is what I added


var player = GetPlayer();
var NewOTP = player.GetVar("otp');



2 Replies

This discussion is closed. You can start a new discussion or contact Articulate Support.