I’ve been working on a password generator website project and recently tried running the JS to check for any bugs. I noticed that it only generates and pushes out special characters from the special character list into the HTML text area. Could someone help me resolve this issue?
Generator code in question (without two of the trigger functions that just run the generators an increased number of times and the needed arrays):
var UpperGenVariable;
var LowerGenVariable;
var NumGenVariable;
var SpecialGenVariable;
function Basic () {
for (var i = 1; i <= 4; i++) {
let FUNNY = Math.floor(Math.random(1,4));
if (FUNNY = 1) {
UppercaseGenerate();
} else if (FUNNY = 2) {
LowercaseGenerate();
} else if (FUNNY = 3) {
NumGenerate();
} else (FUNNY >= 4); {
SpecialGenerate();
}
}
};
let passwordGen = document.getElementById("PasswordDisplay")
function UppercaseGenerate() {
var Upperfiltered = [];
UppergenVariable = Math.floor(Math.random() * LetterIDList.length);
for (var i = 0; i < LetterIDList.length; i++) {
if (LetterIDList[i] == UpperGenVariable) {
UpperFiltered.push(UppercaseList[i]);
}
};
console.log(UpperFiltered);
passwordGen.value += UpperFiltered
};
function LowercaseGenerate() {
var LowerFiltered = [];
LowerGenVariable = Math.floor(Math.random() * LetterIDList.length);
for (var i = 0; i < LetterIDList.length; i ++) {
if (LetterIDList[i] == LowerGenVariable) {
LowerFiltered.push(LowercasList[i]);
}
};
console.log(LowerFiltered);
passwordGen.value += LowerFiltered
};
function Numgenerate() {
var NumFiltered = [];
NumGenVariable = Math.floor(Math.random() * NumIDList.length);
for (var i = 0; i < NumIDList.length; i++) {
if (NumIDList[i] == NumGenVariable) {
NumFiltered.push(NumList[i]);
}
};
console.log(NumFiltered);
passwordGen.value += NumFiltered
};
function SpecialGenerate() {
var SpecialFiltered = [];
SpecialGenVariable = Math.floor(Math.random() * SpecialIDList.length);
for (var i = 0; i < SpecialIDList.length; i++) {
if (SpecialIDList[i] == SpecialGenVariable) {
SpecialFiltered.push(SpecialCharList[i]);
}
};
console.log(SpecialFiltered);
passwordGen.value += SpecialFiltered
};