JavaScript string newline character?

后端 未结 15 2093
终归单人心
终归单人心 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:24

    I had the problem of expressing newline with \n or \r\n.
    Magically the character \r which is used for carriage return worked for me like a newline.
    So in some cases, it is useful to consider \r too.

提交回复
热议问题