I\'m using the below code to try to trim the string in Javascript but am getting the error mentioned in the title:
function trim(str) { return str.replac
You are not passing a string otherwise it would have a replace method. I hope you didnt type function trim(str) { return var.replace(blah); } instead of return str.replace.
replace
function trim(str) { return var.replace(blah); }
return str.replace