在您的职能部门中:
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); }
您没有从函数或设置中返回值
returnTax。当您不返回任何内容时,返回值为
undefined。
也许,您想要这样:
if (taxWage > minWage) { // calculates tax recursively calling two other functions difference() and taxStep() tax = tax + difference(taxWage) * taxStep(taxWage); var newSalary = taxWage - difference(taxWage); return taxes(tax, newSalary); }
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)