get random string in browser javascript
function getRandomString(len=8) {
var res = [];
const c1 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ';
const c2 = c1.toLowerCase();
const choices = c1 + c2 + '0123456789';
for (var i = 0; i < len; i++) {
res.push(choices.charAt(Math.floor(Math.random() * choices.length)));
}
return res.join('');
}