【发布时间】:2021-11-16 21:47:28
【问题描述】:
即使我使用了 JavaScript 模板文字,此代码也不会在多行中呈现。为什么会这样?
document.write(`Today is: ${day}
The time now is: ${hours} : ${minutes} hrs
The year is: ${year}`);
【问题讨论】:
-
文档被解释为 HTML。 HTML 中的换行符在功能上等同于空格。
标签: javascript multiline template-literals