Replace new lines with spaces in JavaScript
Find out how to replace new line characters with spaces in JavaScript.
var sentence = "She\nsells\nshe\nshells\non\nthe\n\sea\nshore"; sentence = sentence.replace(/\n/g, " "); console.log(sentence); //She sells she shells on the sea shore