Trimming A Javascript Variable

I have a javascript variable var newLink = "Bob "; which comes from a xmlhttp.responseText.

I could clean-up the string in my php script. I could also slice at " ,", but I’d like to know how to trim "Bob " with js.

How is that done?

split(’ ‘).join(’'); did the trick. It’s hard to how when there’s a tailor made method and when some assembly is required as I learn javascript.

Here’s an interesting page on a number of the different ways of trimming in javascript: http://blog.stevenlevithan.com/archives/faster-trim-javascript

Thank-you Immerse. Happy Holidays.