问题
I'm getting the missing ) error from the following code. JS Hint says a ) is expected from the top line, but "if" found instead.
denom = (((theZombies[j].y + 15) – theZombies[j].y) * (mouseX – Player1.x) – ((theZombies[j].x + 18) – (theZombies[j].x - 18 )) * (mouseY - Player1.y));
if (denom != 0) {theZombies.splice(j, 1);}
But I don't get it -- all the parentheses are closed off properly. I've also looked back in the code and can't find an unclosed one previously. Any ideas what I'm missing?
Thanks!
回答1:
Your –
characters are atually U+2013 EN DASHes, which are not legal in Javascript.
You need to use U+002D HYPHEN-MINUS instead.
来源:https://stackoverflow.com/questions/18242512/missing-in-parenthetical-error-but-everything-seems-to-be-closed-off-properly