/ Published in: JavaScript
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
function trim12 (str) { var str = str.replace(/^\s\s*/, ''), ws = /\s/, i = str.length; while (ws.test(str.charAt(--i))); return str.slice(0, i + 1); }
URL: http://blog.stevenlevithan.com/archives/faster-trim-javascript