Noin
Noin

Reputation: 41

chrome consloe error "Uncaught SyntaxError: Invalid or unexpected token"?

a = "Πότε να χρησιμοποιήσετε το X-VPN (Αρχικό όνομαFastLemon VPN Free)
Όταν συνδέεστε σε ένα δημόσιο Wi-Fi hotspot,
Όταν παίζετε παιχνίδια και χρειάζεστε ένα καλύτερο δίκτυο,
Όταν κάνετε online αγορές με την πιστωτική σας κάρτα ή το Paypal, όταν επικεντρώνεστε σε πράγματα επιχειρήσεων"

I put this code to chrome console, it's error like

Uncaught SyntaxError: Invalid or unexpected token

this string is Greek, how can I fix this?

Upvotes: 0

Views: 653

Answers (2)

Duc Nguyen
Duc Nguyen

Reputation: 588

This is because special charater: · Middle dot Alt + 249, Alt + 0183 · · in your string. You can replace Alt + 249 with · like:

a = "Πότε να χρησιμοποιήσετε το X-VPN (Αρχικό όνομαFastLemon VPN Free)·Όταν συνδέεστε σε ένα δημόσιο Wi-Fi hotspot,·Όταν παίζετε παιχνίδια και χρειάζεστε ένα καλύτερο δίκτυο,·Όταν κάνετε online αγορές με την πιστωτική σας κάρτα ή το Paypal, όταν επικεντρώνεστε σε πράγματα επιχειρήσεων"

When show in HTML, html will convert to special character. http://fontmeme.com/alt-codes-shortcuts-html-codes-for-special-characters/

Upvotes: 1

Noin
Noin

Reputation: 41

I find this error in chrome console, I select all the string, this red point is the error, I delete it then no error

make it

Upvotes: 0

Related Questions