var characters = 'abcdefghijklmnopqrstuvwxyz0123456789';
var result = ""
var charactersLength = characters.length;
for ( var i = 0; i < 5 ; i++ ) {
result += characters.charAt(Math.floor(Math.random() * charactersLength));
}
console.log(result)
Math.random().toString(36).substr(2, 6); //6 is the length of the string