invalid token 🟨 JavaScript

SyntaxError: Invalid or unexpected token

The code contains a character the parser can’t handle — smart quotes, stray characters or an unterminated string.

Seen on: JavaScript

Meaning

Copy-pasting code from documents or chat replaces ' and " with curly quotes. Unterminated strings across lines and zero-width characters also trigger it.

Common causes

  • Smart/curly quotes from Word, PDFs or chat
  • Unterminated string literal
  • Invisible zero-width or non-breaking space characters

⚡ Quick fix

  1. Retype the quotes
  2. Use template literals for multi-line strings
  3. Reveal invisible characters in your editor

Detailed fix by platform

JavaScript

  1. Search for [“”‘’] and replace with straight quotes

How to diagnose

  1. Character — What is at the column reported?
  2. Recent change — Did it start after a deploy, upgrade, or configuration change? Compare with the last working version.

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.