重複の可能性:
JavaScript 文字列の二重引用符
var array=["famous quote by Shakespear is",""to be or not to be""]
"
要素の区切りに使用する配列の 2 番目の要素のブロック引用符をエスケープするにはどうすればよいですか?
重複の可能性:
JavaScript 文字列の二重引用符
var array=["famous quote by Shakespear is",""to be or not to be""]
"
要素の区切りに使用する配列の 2 番目の要素のブロック引用符をエスケープするにはどうすればよいですか?
バックスラッシュを使用します。
var str = "famous quote by Shakespear is, \"to be or not to be\"";
var str = 'famous quote by Shakespear is, \'to be or not to be\'';
または、引用符の種類を混在させるだけです:
var str = "famous quote by Shakespear is, 'to be or not to be'";
var str = 'famous quote by Shakespear is, "to be or not to be"';
バックスラッシュでエスケープするか、文字列を一重引用符で囲みます。
var array=["famous quote by Shakespear is","\"to be or not to be\""];
var array=["famous quote by Shakespear is",'"to be or not to be"'];
一重引用符と二重引用符は、正しく組み合わせれば交換可能です。