Tuesday, 2 May 2017

Comment on JavaScript may cause "Uncaught ReferenceError :XXX is not defined?

I use visual studio to edit JavaScript and Nodejs. Here I encounter a weird problem: (I include socket.io, vue, on the page ) When I add comment on in index.html

and run on localhost. Chrome console shows Uncaught ReferenceError :XXX is not defined, as below: enter image description here

then simply just remove the comment(I didn't do anything else!) as below: run again , no error is found. enter image description here I did spend a whole night try to figure out what may cause this problem, but no idea come out, someone could offer me some suggestion about why it happens? thanks in advance. (BTW.I tried window.onload but doesn't help.)



via theWorstCoderInTheWorld

No comments:

Post a Comment