前端处理换行符\n问题

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>

<div class="fk" id="fk" style="white-space: pre-wrap">
    '11111'+\n+'11111'+\n+'11111'+\n+'11111'
</div>


</body>

<script>
    var s=document.getElementById('fk').innerText.replace(/(\r\n|\n|\r|\\n)/gm, ' <br/> ')
    document.getElementById('fk').innerHTML=s
</script>
</html>
搜索