Javascript number assist
<p>I'm trying to create a page where a user is prompted to enter a number and it writes the number and adds the suffix at the end. Like if I entered 3, it would write 3rd. I'm confused as to how to go about this, I'm doing this just for fun.    </p>

<pre><code>&lt;html&gt;
&lt;head&gt;
&lt;title&gt;Number Endings&lt;/title&gt;
&lt;script type="text/javascript"&gt; 
// Program name: Number Endings
// Purpose: Add a suffix at the end of a number
// Date last modified: 3/29/12
var numbrentre = "";

numbrentre = prompt("What is the number integer?")

var numbrentre = "";

numbrentre = prompt("What is the number integer?")

function daySuffix(d) {
    d = String(d);
    return d.substr(-(Math.min(d.length, 2))) &gt; 3 &amp;&amp; d.substr(-(Math.min(d.length, 2))) &lt; 21 ? "th" : ["th", "st", "nd", "rd", "th"][Math.min(Number(d)%10, 4)];
}

&lt;/script&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;/body&gt;
&lt;/html&gt; 
</code></pre>
