why does this programming not work? i get the syntax error but why?
var income = prompt(“Enter income:”);
console.log(income);
if (income < 1000){
console.log(“your tax bill is”, income*0.10);
}
else (income >= 1000){
console.log(“your tax bill is”, 100 +((income-1000)*0.30));
}
You are using curvy quotes “
, there should be normal "
Your else
should not have a condition (income...)
, instead, you should use else if
if you need an extra condition to your first if
.
Here is you code but with those fixes.
var income = prompt("Enter income:");
console.log(income);
if (income < 1000) {
console.log("your tax bill is", income * 0.1);
} else if (income >= 1000) {
console.log("your tax bill is", 100 + (income - 1000) * 0.3);
}
Carlos Z
1 Like