removing newline characters javascript

how can i remove new line characters in javascript

ex: "hello there

      good morning


      Thanks".

the final result should be "hello there good morning thanks".
LVL 3
cognos79Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
william007Connect With a Mentor Commented:
This function will be helpful to you
http://www.rgagnon.com/jsdetails/js-0041.html
0
 
cognos79Author Commented:
thanks a lot william it worked..
0
 
william007Commented:
welcome:)
0
 
HonorGodCommented:
 That is very verbose...


  str = "hello there\r\n\r\n\tgood morning\r\n\r\n\r\n\tThanks";

  str = str.replace( /[\r\n\t]/g, '' );
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.