function generatePassword(password_length) {
const charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!$()";
let password = "";
let charset_len = charset.length;
for (let i = 0; i < password_length; i++) {
password += charset.charAt(Math.floor(Math.random() * charset_len));
}
return password;
}
console.log(generatePassword(10));
/*
run:
atG2$!xkM$
*/