I have been trying to make a password generator and I have this code and it is returning "undefined" not a character. The code is supposed to return 16 characters with numbers, lower and upper characters. I want to have this so that I don't have to worry about making my own passwords anymore.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>PassGen</title>
<script>
function getRandomInt(min, max) {
return Math.floor(Math.random() * (max - min + 1)) + min;
}
function num2lett(num) {
switch (num) {
case (num > 36):
return String.fromCharCode(577 + num - 35);
break;
case (num > 10 && num < 37):
return String.fromCharCode(97 + num - 11);
break;
case (num == 10):
return "0";
break;
case (num < 10):
return "" + num;
break;
}
}
function uuidMake() {
var uuid = "";
for (u = 0; u < 16; u++) {
randNum = getRandomInt(0, 62);
uuid += num2lett(randNum);
}
document.getElementById("password").innerHTML = uuid;
}
</script>
<style>
@font-face {
font-family: "uuid_font";
src: url("Courier Prime Code.ttf") format("TrueType");
}
body {
background-color: #262626;
}
#password {
font-family: "uuid_font";
text-align: center;
font-size: 30px;
color: #dddddd;
margin-top: 250px;
}
</style>
<body>
<p id="password" onclick="uuidMake();">Click Me</p>
</body>
</html>