On line 11 why is there a double backward slash "\" When the end production only produces a single slash "\" I am confused as to why mountain doesn't look like this "/''''\" thanks
Asked
Active
Viewed 55 times
1
-
Possible duplicate of [Get backslashes inside a string - Javascript](http://stackoverflow.com/questions/10041998/get-backslashes-inside-a-string-javascript) – 4castle Feb 18 '17 at 18:06
1 Answers
0
When you put a backward slash '\' in a string it has to be escaped with another backward slash since it is a special character in strings.
The backslash is used to for special constructs like tab: \t
or newline: \n
, so to just get a backslash in the string you have to do it twice.

rasmeister
- 1,986
- 1
- 13
- 19
-
ok thanks! so essentially i would need to add a second backward slash \ for every one that i wanted in a string – Jon-Marques psalms Feb 18 '17 at 17:21