Javascript – is there a way to avoid removing line breaks while removing extra spaces from a text file?
for example i am using : string.replace(/s+/g, " ").trim(); // here string being my string name it replaces all extra spaces with a single space along with line breaks as well. But i want the line breaks to stay as…