No visible cause for “Unexpected token ILLEGAL”

后端 未结 11 2234
轻奢々
轻奢々 2020-11-22 00:09

I\'m getting this JavaScript error on my console:

Uncaught SyntaxError: Unexpected token ILLEGAL

This is my code:

11条回答
  •  执念已碎
    2020-11-22 01:04

    This also could be happening if you're copying code from another document (like a PDF) into your console and trying to run it.

    I was trying to run some example code out of a Javascript book I'm reading and was surprised it didn't run in the console.

    Apparently, copying from the PDF introduces some unexpected, illegal, and invisible characters into the code.

提交回复
热议问题