W3Schools Learner's Blog

w3Schools programming knowledge summary website

div

4/28/2018

uncaught syntaxerror unexpected identifier error in Javascript or Jquery

uncaught syntaxerror unexpected identifier error in Javascript or Jquery

"Uncaught SyntaxError: Unexpected identifier", the Javascript/Jquery error is often encountered, this time the use of Chrome Google browser debug JS to appear again this exception, not too much care before, so when writing JavaScript code is always the problem.

But it's easy to solve this problem, for example, this error code:
  1. <script type="text/javascript">
  2. var str = Hello World;
  3. </script
STR is a string type, but no "" symbol, so there is "Uncaught SyntaxError: Unexpected identifier" error.
change the above code, as follows:
  1. <script type="text/javascript">
  2. var str = "Hello World";
  3. </script
ok, thanks!

No comments:

Post a Comment

Note: only a member of this blog may post a comment.