Archive for the ‘ JavaScript ’ Category
JavaScript does not offer a lot of things one would imagine would be included in such a seasoned scripting language. Below are a few functions I wrote to fill some gaps. Trimming the whitespace off both sides of a string function trim(str) { return str.replace(/^\s\s*/, "").replace(/\s\s*$/, ""); }; Padding the start of a string function pad(str, len, padding) { str += ""; if [ READ MORE ]