<script type="text/javascript"> var pad = function(tbl) { return function(num, n){ return (0 >= (n - ''+num.length)) ? num : (tbl[n] || (tbl[n] = Array(n + 1).join(0)))+num; } }([]); alert(pad(233, 6)); </script>
<script type="text/javascript"> var pad = function(tbl) { return function(num, n){ return (0 >= (n - ''+num.length)) ? num : (tbl[n] || (tbl[n] = Array(n + 1).join(0)))+num; } }([]); alert(pad(233, 6)); </script>