Replace line separator with <br> - Node.js String

Node.js examples for String:HTML String

Description

Replace line separator with <br>

Demo Code

String.prototype.br = function() {
  return this.replace(/\n/g, '<br>')
}

Related Tutorials