So I'm writing a piece of coed for my brother and I think it is really odd because the first console log outputs undefined, which is expected, and the second one outputs '1229/4096', which is what I would expect too, but the third one outputs undefined which I think is pretty odd. If anyone can tell me why or help me fix it, or even ask for any other bits of code, I would love some help!
let catchRate = document.getElementById('catchRate').value;
let x;
console.log(x)
if (catchRate >= 0 && catchRate <= 30) {
let x = (1229/4096);
console.log(x);
} else if (catchRate >= 31 && catchRate <= 150) {
let x = (2048/4096);
} else if (catchRate < 150) {
let x = (2867/4096);
}
console.log(x)
Aucun commentaire:
Enregistrer un commentaire