JavaScript Bug: Sneaky Greek Question Mark

Ever had perfectly fine-looking code… that just won’t run? 🤯 I ran into a sneaky JavaScript bug today: let x = 5; console.log(x) Looks correct, right? But it throws an error. The culprit 👉 that tiny character after 5 is not a real semicolon. It’s actually a Greek question mark (;) instead of the standard ;. ➡️ JavaScript doesn’t recognize it ➡️ The code breaks silently ➡️ You waste time debugging something that looks fine ✅ Fix: let x = 5; console.log(x); 💡 Lesson: Not all characters that look identical are actually the same — especially when copying code from PDFs, websites, or different keyboards. Sometimes debugging isn’t about logic… it’s about spotting the invisible. #JavaScript #Coding #Debugging #WebDevelopment #ProgrammingTips

  • No alternative text description for this image

This takes me back to the good ol' days of Slack introducing the "zero-width space" character into their posts. How do you even debug a character that you can't see; https://en.wikipedia.org/wiki/Zero-width_space

Like
Reply

To view or add a comment, sign in

Explore content categories