function numberOfSupports (shipLvl){
shipLvl = parseInt(shipLvl);
let num = shipLvl-1;
console.log(shipLvl);
console.log("working3")
if(shiplvl >= 2) {
console.log("working4")
for(let x= 0; num==x; x++) {
var values = ["emp", "teleport", "red-Star-Extender", "remote-Repair", "time-Warp", "unity", "santuary", "stealth", "fortify", "impulse", "alpha-Rocket", "salvage", "suppress", "destiny", "barrier", "vengence", "delta-Rocket", "leap", "bond", "alpha-Drone", "suspend", "omega-Rocket", "remote-Bomb"];
console.log("working5")
var select = document.createElement("select");
select.name = `support ${x}`;
select.id = `support ${x}`;
console.log(select.id, select.name)
for (const val of values) {
var option = document.createElement("option");
option.value = val;
option.text = val.charAt(0).toUpperCase() + val.slice(1);
select.appendChild(option);
}
}
}
}
So I’m having an issue with an if statement not working and I was hoping that someone could help me. This code is meant to create a number of drop down selection inputs so I can collect the value of the support units a player wants. But for whatever reason, its not getting by the if statement. I’ve tested it dozens of times trying to figure out why its not working, but for the life of me, I can’t find the issue.
Also, the last curly bracket is not matching with the code but with the text of this forum. No clue as to why.