BTC: 3B74XpJ12oucMsEgxVbZqwYd6XPgGs8GXt / ETH: 0xae7d573142e3b918cc9d2b0bf35a5f9cb35619e3

Friday, 24 May 2024

Function to generate random alphanumeric string of given length JAVASCRIPT

function generateRandomAlphaNumeric(length) {

    const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';

    let result = '';

    for (let i = 0; i < length; i++) {

        result += characters.charAt(Math.floor(Math.random() * characters.length));

    }

    return result;

}


No comments:

Post a Comment