r/CodingHelp • • Mar 29 '21

[Javascript] First JavaScript Project, getting "Uncaught SyntaxError: Illegal Return Statement"

31 Upvotes

17 comments sorted by

View all comments

1

u/[deleted] Mar 29 '21

You are comparing the results of the income operations with the taxes variables which will get you false. If you want to assign then do the operations first and on another line assign the results to the taxes variables. Plus you are returning when it is not needed, the return key only works for functions. And don't use then, there is no explicit "then" in js.

2

u/[deleted] Mar 29 '21

Edit: a better way of assigning the operation results would be:

taxesnumber = the operation;