using java script to check if string is numbers only
<p>using javascript to check if string is numbers only  this is what i have but its not running any suggestions would the appreciated thanks much in advance. also if it is a string of numbers only then all numbers after the first two digits should be masked.</p>

<pre><code> var start = function RenderRC(CodeOwner) {

     var pattern = /^\d+$/;
     var Rcode = CodeOwner.toString();

     if (Rcode.valueOf.match(pattern)) {
        if (Rcode.length &gt; 2) {
            var newcode = Rcode.substr(0, 2) + Array(Rcode.length - 2 + 1).join("*");
            return newcode;
        }
     } else {
        return Rcode;
     }
 }; 
</code></pre>
