多行模板string没有换行符?
我有这一行代码:
console.log(`now running each hook with name '${chalk.yellow(aBeforeOrAfterEach.desc)}', for test case with name '${chalk.magenta(test.desc)}'.`);
问题是我必须把它放在我的IDE中的多行,因为它适合(我走100列)。 当我把模板string放在多行上时,模板string将其解释为换行符,这不是我想要的。
所以我的问题是 – 我怎么能有多行的模板string代码,而不必用新的行字符logging?
在每行的末尾使用反斜杠 – \
– 以避免插入\n
console.log(`\ now running each hook with name \ '${'foo'}', for test case with name '${'bar'}' \ .`);