this snippet implements "string".trim() in Javascript, as found in many other languages.
if!Stringprototype trim
return thisreplace/^\s*/""replace/\s*$/"";
another for basename():
if!Stringprototype basename
return thisreplace/^.*\//'';