I have Uncaught SyntaxError: Unexpected identifier
from the file VM3154:1
.
The error appears after I login with a Parse user.
I try to locate the file in my server and I cannot find this file. This file has only one line of code:
[object Object]
Anybody knows what is this file? What does it do?
There is an increment for the number every time I log in using Parse User function.
My web uses jQuery, AngularJS, Parse and Bootstrap.
This can occur when a callback function is expected, but the code is returning an object instead. My specific case was a new
before the function
passed to setTimeout
, and I only figured it out thanks to this answer: https://stackoverflow.com/a/31502293 (Firefox edition: https://stackoverflow.com/a/20218837)
setTimeout
expects the first parameter to be a function
NOTE: Sometimes this error occurs when a missing quote in JSON causes a comma to be treated as part of the preceding string, eg: ['test1,'test2']
.
Example.html to reproduce:
<script>
setTimeout(new function() { document.write('test') },0);
</script>
Instead of clicking the VM61:1
(the number auto-increments) link on the right-hand side, click the gray drop-down arrow/icon on the lef-hand side between the error icon and the words Uncaught SyntaxError
to show the call stack and click the first link in the list (see screencast below).
This will jump one frame up the callstack and usually highlight the entire line where the error occurred. It will not pinpoint the exact location of the error but review here carefully for anything that could be returning an object when a callback function is expected.
Remove the new
and the error goes away!
PS. This error appeared in Internet Explorer 10 (unless it is running in Compatability Mode) as
SCRIPT1007: Expected ']'
example.html, line 1 character 9
And in Firefox 56 as
SyntaxError: missing ] after element list[Learn More] example.html:2:8
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