Error expected identifier string or number
Stack Overflow for Teams is a private, secure spot for you and your coworkers to find and share information. Some users are reporting occasional JS errors on my site. The error message says "Expected identifier, string or number" and the line number is , which is just an arbitrary number and changes for each report when this occurs.
I say error in quotes because it was fine everywhere but on IE. This was under IE6. The problem was related to JSON object creation and an extra comma, such as. IE6 really doesn't like that comma after 3. You might look for something like that, touchy little syntax formality issues. This is a definitive un-answer: eliminating a tempting-but-wrong answer to help others navigate toward correct answers.
It might seem like debugging would highlight the problem. However, the only browser the problem occurs in is IE, and in IE you can only debug code that was part of the original document. For dynamically added code, the debugger just shows the body element as the current instruction, and IE claims the error happened on a huge line number.
I like to use JSLint to find these bugs. It will find these improperly placed commas, among other things.
- IE ERROR: Expected Identifier, string or number.
- "Expected identifier, string or number" error when using IE7 - Meta Stack Exchange.
- Progress KB - "Expected identifier, string or number" error in IE7;
- NagVis Error with Internet Explorer 8 (Expected identifier, string or number).
- registry of sex offenders in minnesota.
- [Solved] IE9 SCRIPT Expected identifier, string or number - CodeProject.
You will probably want to activate the option to ignore improper whitespace. In addition to improperly placed commas, at this blog in the comments someone reported:. I've been hunting down an error that only said "Expected identifier" only in IE 7. My research led me to this page. After some frustration, it turned out that the problem that I used a reserved word as a function name "switch".
THe error wasn't clear and it pointed to the wrong line number. This error occurs when we add or missed to remove a comma at the end of array or in function code. It is necessary to observe the entire code of a web page for such error. This sounds to me like a script that was pulled in with src, and loaded just halfway, causing a syntax error sine the remainder is not loaded. Another variation of this bug: I had a function named 'continue' and since it's a reserved word it threw this error. I had to rename my function 'continueClick'.
You may hit this problem while using Knockout JS.
- to search a person for concealed weapons?
- sex offenders nys st lawrence county.
- mapState() and the Rest/Spread Operator In Edge - vuex - Vue Forum.
If you try setting class attribute like the example below it will fail:. I too had come across this issue.
"Expected identifier, string or number" script error when accessing MapInfo Pro Geocoding services
I found below two solutions. Same as mentioned by others above, remove extra comma from JSON object. Because of this it was triggering browser's old mode which was giving JS error for extra comma. Copy the code from the console into your IDE. Most IDE's perform error checking on the code and highlight errors.
Had the same issue with a different configuration. This was in an angular factory definition, but I assume it could happen elsewhere as well:.
This can also happen in Typescript if you call a function in middle of nowhere inside a class. For example. Function calls, like console. Not in the area where you should be declaring class fields. We now integrate with Microsoft Teams, helping you to connect your internal knowledge base with your chat. Learn more.
Add your solution here