1 line of code: How to convert \newlines to <breaks />
const nl2br = (str) =&gt; str.replace(/\r?\n/g, "&lt;br /&gt;");        Enter fullscreen mode    ...
Tags: javascript, webdev, product, codequality