Replace all chars with #, except for last 4
<pre><code>function maskify(cc) {
    var dd = cc.toString();
    var hash = dd.replace((/./g), '#');
    for (var i = (hash.length - 4); i &lt; hash.length; i++) {
        hash[i] = dd[i];
    }
    return hash;
}
</code></pre>

<p>I am trying to replace all chars with <code>#</code> except for last 4. Why isn't it working?</p>