Scoring Hand of Card Objects
<pre><code>// function scoreHandArray scores your hand
function scoreHandArray(hand) {
    var score = 0;
    for (i=0,i&lt;hand.length,i++) {
        score = score + hand[i].value;
    };
    return score;
};

console.log( "You have the " + player[0].face + " of " + player[0].suit " and the " + player[1].face " of " + player[1].suit " for a score of " scoreHandArray(player));
</code></pre>

<p>Hello, it's me again!  This function here has an error in it that I cannot find, returning <code>SyntaxError: Expected ';'</code>.  (I know it is the function, because commenting out the console.log changes nothing.)  Function <code>scoreHandArray</code> takes an array of objects and returns the score of the objects.  Full source code here:</p>

<pre><code>// This code defines the Object constructor Card, used to make the card objects
var Card = function(card) {
    this.face = theFace(card);
    this.suit = theSuit(card);
    this.value = theValue(card);
};

// This code creates the Deck to be used.
var deck = [];
for ( i=0 ; i&lt;52 ; i++ ) {
    deck.push( i );
};
for ( i=51 ; i&gt;0 ; i-- ) {
    var random = Math.floor(Math.random()*i);
    var temp = deck[random];
    deck[random] = deck[i];
    deck[i] = temp;
};
// 0-12 is Spades.
// 13-25 is Hearts.
// 26-38 is Clubs.
// 39-51 is Diamonds.

// Now we create the hand of the player and dealer
var player = [];
var dealer = [];

// Now to deal a card to player
player.push(deck.pop());
dealer.push(deck.pop());

// and another
player.push(deck.pop());
dealer.push(deck.pop());

// function theFace gives the face of a card
function theFace( card ) {
    var faces = ["King","Ace","2","3","4","5","6","7","8","9","10","Queen","Jack"];
    return(faces[card%13]);
};

// function theValue uses 'switch' to determine points from a card
function theValue(card) {
    var value = card % 13;
    switch( value ) {

        case(0):
        case(11):
        case(12):
            value = 10;
            break;

        case(1):
            value = 11;
            break;

        default:
            value = value;
            break;

    };
    return value;
};

// function theSuit returns the suit of a card
function theSuit(card) {
    var suit;
    if(card&gt;38) {
        suit = "Diamonds";
    }else if(card&gt;25) {
        suit = "Clubs";
    }else if(card&gt;12) {
        suit = "Hearts";
    }else {
        suit = "Spades";
    };
    return suit;
};

// function toObject the first (numbered) card of of a hand 
// and turns it into an Object with the desired properties
function toObject( hand ) {
    var card = hand.pop();
    if (typeof(card) !== "number") {
        hand.push(card);
    } else {
        var card = new Card (card);
        hand.unshift(card);
    };
    return hand;
};

toObject(player);
toObject(player);
toObject(dealer);
toObject(dealer);

// function scoreHandArray scores your hand
function scoreHandArray(hand) {
    var score = 0;
    for (i=0,i&lt;hand.length,i++) {
        score = score + hand[i].value;
    };
    return score;
};

console.log( "You have the " + player[0].face + " of " + player[0].suit " and the " + player[1].face " of " + player[1].suit " for a score of " scoreHandArray(player));
</code></pre>

<p>Strange, now after replacing the <code>,</code>s in the <code>for</code> loop with <code>;</code>s, it now responds <code>ReferenceError:  expected ')'</code>.  What <code>)</code> could it want?  (The error appears to be in the last <code>console.log</code> line, as commenting it out makes the error dissapear.)  I counted, in that line I have 2 <code>(</code> and 2 <code>)</code>!</p>
