JSFiddle - React, Tailwind, and code Playground

by jfriend00

HTML

<pre id="input"></pre>
<hr>
<pre id="output"></pre>

JavaScript

var str = "0123456789\r\n0123456789\r\n0123456789\r\n0123456789";
document.getElementById("input").innerHTML = JSON.stringify(str);
document.getElementById("output").innerHTML = JSON.stringify(str.replace(/[\r\n]/g, ""));