i am trying to make a simple trim function but this doesnt works. any help pls?
function tr(input){
var i;
var str;
for(i=0; i<input.length-1; i++){
if(text.charAt(i)==" "){
str+=""+text.charAt(i)
}
return str
}
}