Trim() function in Chrome not working

Hey guys,

Am I missing something here? My trim() function seems to halt JavaScript execution in Chrome. Why is this?

function trim(s) {
			s = s.replace(/(^\\s*)|(\\s*$)/gi,"");
			s = s.replace(/[ ]{2,}/gi," ");
			s = s.replace(/\
			return s;

It works in IE and firefox… wait no it doesn’t. not anymore. wtf.

It seems to work for some things but not others. It will work for a flat out string, but not a variable.

Got it to work. I was passing the function an object instead of a string. Ooops!