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
你说它递归,但没有代码在这里递归。 –