This forum is now read-only. Please use our new forums at

Animate Your Name Forum

View Course

316 points
Submitted by
Cansu Kaya
about 4 years ago

[resolved] Why \ symbol is not allowed when I write a string?

When I type ~ document.write( "Cansu\" ); ~ string, an error returns:Uncaught SyntaxError: Unexpected token ILLEGAL.

Simply, why can't I use \ symbol in a string?


1 vote


The backslash character is used as the escape character. This means that you cannot include one in your string unless you escape it, in other words you must type two of them together (\\).

Having an escape character comes in handy when you need to print quotes within quotes and also some unprintable characters like tabs and line feeds.

3698 points
Submitted by
about 4 years ago


532ffc8f631fe915ae008c4b_929057727 Cansu Kaya about 4 years ago

Thank you ^^

55df2afa95e3787b9200005e_359368177 Judy about 4 years ago

You're welcome!