0

I have a string: let value = "Emrah Tebrikeder120\'\'\'\'\'\'\'";. When I try to output it to the console, all the \ are deleted. How do I make all the \ in the string appear?

John
  • 33
  • 7
  • 1
    https://stackoverflow.com/questions/10041998/how-can-i-use-backslashes-in-a-string answers the question – 35308 Jul 02 '22 at 18:07

2 Answers2

1

Use a double-backslash, like this:

let value = "Emrah Tebrikeder120\\'\\'\\'\\'\\'\\'\\'";

The "\'" is considered as escape sequence.

lukasl-dev
  • 724
  • 3
  • 11
0

\ is an escape character so, it will be ignored. If you want to keep it, you will need to escape the escape character (put double \). Like this:

let value = "Emrah Tebrikeder120\\'\\'\\'\\'\\'\\'\\'";
User456
  • 1,216
  • 4
  • 15