Problems writing script for blackjack game
<p>I'm trying to write a script for a Black Jack game but have run into some problems. This is the code I've included in the head:</p>

<pre><code>&lt;script type="text/javascript"&gt;
var J = 10;
var Q = 10;
var K = 10;
var A = 11;
var deck = [1,2,3,4,5,6,7,8,9,10,J,Q,K,A];

function deal() {
var test = "hello";
var f_card = Math.floor(Math.random() * deck.length);
var s_card = Math.floor(Math.random() * deck.length);
var card1 = deck[f_card];
var card2 = deck[s_card];

if (card1 == J) {
    card1 = "Jack";
    }
else if (card1 == Q) {
    card1 = "Queen";
    }
else if (card1 == K) {
    card1 = "King"
    }
else if (card1 == A) {
    card1 = "Ace"
    }

if (card2 == J) {
    card2 = "Jack";
    }
else if (card2 == Q) {
    card2 = "Queen";
    }
else if (card2 == K) {
    card2 = "King"
    }
else if (card2 == A) {
    card2 = "Ace"
    }

var bucket = card1 + ", " + card2;
var res = f_card + s_card
document.getElementById("result").innerHTML = bucket;
document.getElementById("test").innerHTML = f_card + ", " + s_card;
if (res == 22) {
    alert("Blackjack!")
    }
}
&lt;/script&gt;
</code></pre>

<p>The body reads as follows: </p>

<pre><code>&lt;body&gt;
&lt;form&gt;
    &lt;input type="button" value ="Deal" onclick="deal()" /&gt;&lt;br /&gt;&lt;br /&gt;
&lt;/form&gt;
&lt;div id = "result"&gt;
&lt;/div&gt;&lt;br /&gt;
&lt;div id = "test"&gt;
&lt;/div&gt;
&lt;/body&gt;
</code></pre>

<p>I added the "test" div to see what was happening inside the deal, and it looks like "Jack" is being assigned to all array value above 9. How can I have the other if statements processed as well? Any help at all would be much appreciated.</p>
