I’m trying to create my first web app, a tax calculator problem is the first time I press the button it gives me a wrong figure…but when I do Ctrl+s to save the code again ,and press the button a second time it gives the correct results.How can I correct that so the first button press gives the correct answer? You can also advise on best practices to write code I’m still learning so I just kind of write it how it comes to my head …form/script.js at master · twicemuch/form · GitHub that’s the link to my js code on GitHub
The ones under titles basic salary and allowances.
Yes I’m getting those same results on the first click ,but when I save the code and click again it gives me the results in the first image .
Wish there was a way I could share a short video of what I’m explaining so you could see
Seems to be because of how you are calling findGross
and using grossTotal
in the outer scope. If you remove the outer scope code and replace all instances of grossTotal
with a call to findGross
does it work as expected?
1 Like
Did as you said and It is now working correctly,thank you very much for your help
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.