Reputation: 103497
My strings will hold the values:
"["
"[/blah]"
do I need to escape anything?
Is it just doubling the /?
Upvotes: 0
Views: 259
Reputation: 15192
If your string are "[" "[/blah]"
, then you don't need to escape anything if you use single quote:
var foo = '"[" "[/blah]"';
Upvotes: 2
Reputation: 37126
Since this is a literal string square brackets or forward slash will not be interpreted so in your example you don't need to escape anything. Doubling applies to a backward slash only \
Upvotes: 1