JavaScript: creare un PIN numerico per un sistema OTP

JavaScript: creare un PIN numerico per un sistema OTP

Con JavaScript possiamo creare un PIN numerico da usare in un sistema OTP.

La soluzione รจ la seguente:


'use strict';

const createPin = () => {
    let min = 1000;
    let max = 9999;
    return (Math.floor(Math.random() * (max - min)) + min).toString();
};

Torna su