是否有可能在javascript多行字符串中添加注释?
这样的事情:
var string = 'START - \
This is part of my string\
\\ This should be escaped!\
-END ';
// string = 'START - This is part of my string - END';
由于
答案 0 :(得分:3)
我找到了一种可能性:
var string ='START - \
This is my string'+
// This should be escaped!
' - END';
// string = 'START - This is my string - END'
但它不太好......
答案 1 :(得分:2)
这种方式不可能。你可以这样做:
var s = "multi line" +
//" line" +
" string";
答案 2 :(得分:0)
你试过这样的事吗?
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';