Ask coding questions

← Back to all posts
How can I fix this syntax error?(FIXED)

I've been getting this error message the whole day:
'SyntaxError: Unexpected end of input
at /:14:56'

..and I can't figure out how to fix it. I've checked my code multiple times and I can't find anything wrong with it.

(Note: what I'm trying to do is make the button add to the amount of lumber, as in, increase the number. But every time I click the button, it gives me the error and nothing else happens after that.)

Answered by MrEconomical [earned 5 cycles]
View Answer

onclick = "woodClick(1)" should fix


@MrEconomical I tried that just now, and it produces this error instead: ReferenceError: woodClick is not defined
at HTMLButtonElement.onclick (/:14:39)


@TheOracle its not scr its src and you can delete the text inside of the script


@MrEconomical it works perfectly fine as 'scr', and when I changed it to 'src' it stops working. Plus, I also fixed all the current errors I had and my code is working fine. Turns out that the reason it didn't show how much wood was gathered was because I hadn't coded that yet, so I'm doing that now.


@TheOracle it works fine as src because its executing the contents of the script tag itself, the text inside the script. if you actually want to run the script main.js change it to src