1
我有一個計算稅款的函數。遞歸函數返回undefined
function taxes(tax, taxWage)
{
var minWage = firstTier; //defined as a global variable which is not 2299.
if (taxWage > minWage)
{
\\calculates tax recursively calling two other functions difference() and taxStep()
tax = tax + difference(taxWage) * taxStep(taxWage);
var newSalary = taxWage - difference(taxWage);
taxes(tax, newSalary);
}
else
{
returnTax = tax + taxWage * taxStep(taxWage);
return returnTax;
}
}
我看不出爲什麼它不會停止遞歸。
什麼是你的問題?而且,這段代碼與你的問題的標題有什麼關係? – jfriend00
謝謝。編輯。 – raam86
你說它遞歸,但沒有代碼在這裏遞歸。 –