Reputation: 11778
Is there a possibility to add comment inside a javascript multiline string?
Something like this:
var string = 'START - \
This is part of my string\
\\ This should be escaped!\
-END ';
// string = 'START - This is part of my string - END';
Thanks
Upvotes: 3
Views: 1958
Reputation: 15351
It's not possible this way. You can do:
var s = "multi line" +
//" line" +
" string";
Upvotes: 3
Reputation: 1
Have you try something like this?
var string = 'This is part of your string';
string += 'This is second part of your string'; //Comment yout want to add
string += 'This is thirdpart of your string';
Upvotes: 0
Reputation: 11778
I found one possibility:
var string ='START - \
This is my string'+
// This should be escaped!
' - END';
// string = 'START - This is my string - END'
But it's not so nice...
Upvotes: 4