So I am working on a loan calculator in JavaScript. So I keep running into this problem to where when a user enters a number for above 400 but below 500 it will not run that if statement but instead it will run the other else if statement where if a number is above 500 and below 640. The following code I am talking about is down below. Any help will be appreciated.
else if (500 < getCredit < 640){
alert("This is it");
score += 6
console.log("The score is " + score);
}
else if (400 < getCredit < 500) {
score += 0 // The else if statement above is executed and not this one whenever conditions are met
}
Below is the rest of code Js code
function myFunction() {
score = 0;
var getCredit = parseInt(document.getElementById("credit").value);
if(getCredit > 640){
score += 12
console.log("The score is " + score);// This is working the right way
}
else if (500 < getCredit < 640){
alert("I learned something at Mathnasium");
score += 6
console.log("The score is " + score);
}
else if (400 < getCredit < 500) {
score += 0
}
}
Aucun commentaire:
Enregistrer un commentaire