You're using commas ,
instead of semi-colons :
in your for loop. It should be:
for(i = array.length - 1; i >= 0; i--) {
You're getting the Unexpected Token
error because the compiler was expecting there to be three expressions, separated by semi-colons. When you write it with commas it thinks the whole line is one expression, since a comma is not a delimiter in that case.
As was mentioned in a comment, using a javascript linter such as JSHint is a good idea, especially if you're new to the language. A linter will inspect your code and point out any issues with tidiness, consistency, compatibility and common mistakes. Linters can be installed as build tools or directly into many code editors to catch errors as you write.