Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript syntax errors in IE

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?

like image 494
Steve M Avatar asked Feb 17 '09 23:02

Steve M


People also ask

How to fix script1002 syntax error in Internet Explorer?

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:

What happens when script errors occur in Internet Explorer?

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.

What is SyntaxError in JavaScript?

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.

What does error message mean in Internet Explorer status bar?

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.


1 Answers

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',]
like image 89
Tyson Avatar answered Oct 26 '22 03:10

Tyson