generate random alphanumeric string javascript

JavaScript
Math.random().toString(36).substr(2, 6); //6 is the length of the string
Source

Also in JavaScript: