NewLine转义字符不起作用
- 论坛
- NewLine转义字符不起作用
39 浏览
NewLine转义字符不起作用
我们知道在JavaScript中,\n用于换行。
我应该如何在输出中使用它(在for循环中):
str = prompt("输入任意字符串!"); for (i = 0; i < str.length; i++) { document.write('\n' + str.charCodeAt(i)); }
或者
str = prompt("输入任意字符串!"); for (i = 0; i < str.length; i++) { document.write('\n' + str.charCodeAt(i)); }
似乎都不起作用。