Both \n (new line) and \r (carraige return) create a new line. To replace all instances of both at the same time:
s.replace(/[\n\r]/g, '');
Note that you might want to replace them with a single space rather than nothing.
Both \n (new line) and \r (carraige return) create a new line. To replace all instances of both at the same time:
s.replace(/[\n\r]/g, '');
Note that you might want to replace them with a single space rather than nothing.