5.1.18 多行字符串字面量

使用加号(+)连接,禁止使用反斜杠()换行
不要这样写:

var myString = 'A rather long string of English text, an error message \
     actually that just keeps going and going -- an error \
     message to make the Energizer bunny blush (right through \
     those Schwarzenegger shades)! Where was I? Oh yes, \
     you\'ve got an error and all the extraneous whitespace is \
     just gravy.  Have a nice day.';

空白字符开头字符行不能被很安全的编译剥离,以至于斜杠后面的空格可能会产生奇怪的错误。虽然大多数脚本引擎都支持这个,但它并不是ECMAScript标准的一部分。
可以用+号运算符来连接每一行:

var myString = 'A rather long string of English text, an error message ' +
    'actually that just keeps going and going -- an error ' +
    'message to make the Energizer bunny blush (right through ' +
    'those Schwarzenegger shades)! Where was I? Oh yes, ' +
    'you\'ve got an error and all the extraneous whitespace is ' +
    'just gravy.  Have a nice day.';

在实际开发工作中,字符串拼接通常是变量和字符串的结合,我们更推荐一下的方式:

this.timeStamp = `保存时间:${hour}:${minute}`