JavaScript string newline character?

后端 未结 15 2098
终归单人心
终归单人心 2020-11-22 08:06

Is \\n the universal newline character sequence in Javascript for all platforms? If not, how do I determine the character for the current environment?

I

15条回答
  •  不要未来只要你来
    2020-11-22 08:20

    I believe it is -- when you are working with JS strings.

    If you are generating HTML, though, you will have to use
    tags (not \n, as you're not dealing with JS anymore)

提交回复
热议问题