[Solved] Function not executing, something must be wrong [closed]


You have syntax error in “if else”. You need to use like “else if”. Update your function like below.

function getTaxRate(inIncome) {
var taxRate;
var taxIncome = parseInt(inIncome);
if (taxIncome >= 0 && taxIncome <= 8925)
{
    taxRate = RATE_ONE;
}
else if (taxIncome >= 8926 && taxIncome <= 36250)
{
    taxRate = RATE_TWO;
}
else if(taxIncome >= 36251 && taxIncome <= 87850)
{
    taxRate = RATE_THREE;
}
else if(taxIncome >= 87851 && taxIncome <= 183250)
{
    taxRate = RATE_FOUR;
}
else if(taxIncome >= 183251 && taxIncome <= 398350)
{
    taxRate = RATE_FIVE;
}
else if(taxIncome >= 398351 && taxIncome <= 400000)
{
    taxRate = RATE_SIX;
}
else (taxIncome >= 400001)
{
    taxRate = RATE_SEVEN;
}
return taxRate;
}

1

solved Function not executing, something must be wrong [closed]