Create id from letter and digits - Node.js Security

Node.js examples for Security:GUID

Description

Create id from letter and digits

Demo Code

function makeid(length, counter)
{
    var text = "";
    var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

    for( var i=0; i < length; i++ )
        text += possible.charAt(Math.floor(Math.random() * possible.length));

    return text + counter;
}

export default makeid;//from   w  w w  .jav a 2  s . c o  m

Related Tutorials