I am trying to use google closure compiler on my javascript files. It works fine except for the following piece of code:
function goto(form) { var index=form.select.selectedIndex
if (form.select.options[index].value != "0") {
location=form.select.options[index].value;}}
The compiler returns:
JSC_PARSE_ERROR: Parse error. missing ( before function parameters. at line 1 character 9 function goto(form) { var index=form.select.selectedIndex
There is a caret (^) pointing to the g in "goto" when it is output on the screen.
I am using just the basic UI version here to test:
http://closure-compiler.appspot.com/home
Any idea what is wrong with the javacript? It seems to work just fine but I am not a javascript person so I have no clue how to fix it.
I am not sure why @Sirko deleted his answer. So I will add it.
You need to change the name of the function goto to something else. Something like gotoUrl, gotoPage, etc.
It was a reserved word in ECMAScript 3, but removed in ECMAScript 5. I am guessing the closure compiler uses that older list still.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With