Chaining JS methods
<p>I'm trying to insert some whitespace in a string if the string conforms to a certain format. Specifically, if the string consists of only numbers, and is exactly five characters in length, whitespace should be added between the third and fourth numbers.</p>

<p><a href="http://jsfiddle.net/LwAg9/" rel="nofollow">Here's my test case:</a></p>

<pre><code>function codeAddress() {
    var num_regex = /^\d+$/,
            input = $("#distributor-search").val(),
          address = (input.match(num_regex) &amp;&amp; input.length == 5) ? input.split('').splice(3, 0 , ' ').join() : input ;

    console.log('The address is: ' + address);

    return false;
}
</code></pre>

<p>For some reason, chaining <code>.split()</code>, <code>.splice()</code> and <code>.join()</code> seems to not return anything. Where am I going wrong?</p>
