👋 Hello! I'm Alphonsio the robot. Ask me a question, I'll try to answer.
In JS, how to remove carriage return from string?

In JavaScript, to remove carriage return from string, use the following regex str.replace(/[\n\r]/g, ''); as on the following example :

var str="abc \n def \r ghi";

// Should change str for "abc  def  ghi"
str.replace(/[\n\r]/g, '');


More