See? Full code is really valuable. I know see the error, which was impossible in the code you posted when you created this topic
you nested the getTax function inside the getSubTotal function, you shouldn’t have done that. The getTax function should be outside/after the getSubTotal function