正文

JavaScript中替换字符串中的换行符可以使用多种方法,以下是一些常见的方法: 1. 使用 `replace()` 方法: ```javascript let str = "这是第一行\n这是第二行"; let newStr = str.replace(/\n/g, '
'); //