Multiline strigs in JavaScript

586 ワード

I used to write multiiline strigs in JavaScript like this:
var str = 'This is ' +
'a very long ' +
'sentence.'
Sometimes,i wrote it this way:
var str = ['This is ',
'a very long ',
'sentence.'].join('');
Using array to contact stings is an effective way.I also see an implement of String Buider in JavaScript usthis technology.
Today、i was surpresd to find the third way:
var str = 'This is \
a very long \
sentence.';
just cool!