I have created a fairly large Javascript app that works in Firefox and up until yesterday, IE. I've made quite a few changes and now I'm getting syntax errors in IE, but all is fine in Firefox. Obviously I have a trailing comma somewhere but I can't see it. IE's error message is less than helpful, not even telling me which JS file has the error.
Is there a syntax checker for Javascript that will inform me of such errors in more detail?
Works fine on Firefox and Chrome, but Internet Explorer shows SCRIPT1002: Syntax Error and not run the script…IE flag this portion as syntax error: (result) => {} is an arrow function which is completely unsupported in IE. To fix this you’ll have to use a traditional anonymous function:
When script errors occur in Internet Explorer, you may receive following error messages: Problems with this Web page might prevent it from being displayed properly or functioning properly. In the future, you can display this message by double-clicking the warning icon displayed in the status bar.
The SyntaxError object represents an error when trying to interpret syntactically invalid code. It is thrown when the JavaScript engine encounters tokens or token order that does not conform to the syntax of the language when parsing code. Creates a new SyntaxError object.
Line:<LineNumber> Error:<ErrorMessage> The following warning message may also appear in the Internet Explorer Status bar: Done, but with errors on page. This problem occurs because the HTML source code for the webpage doesn't work correctly with client-side script, such as Microsoft JScript or Microsoft Visual Basic script.
http://www.jslint.com/ will catch those comma and semicolon problems.
Example:
Error:
Problem at line 1 character 17: Extra comma.
var foo = ['bar',]
Problem at line 1 character 19: Missing semicolon.
var foo = ['bar',]
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