This makes NO SENSE at all:
randomCard = Deal();
a = randomCard;
player  = randomC();
You get a randomCard
. Fine. Then, for some weird reason, you assign it to the variable a
Why didn't you simply code
a = Deal();
But then you set player
to the result of calling the function randomC()
*APPARENTLY* you have a Deal( )
function that returns one random card. That's great. But then why do you have *ANOTHER* function randomC()
that does the same thing????
On top of that, you get the score for the player by adding player and player. But why in the world would *THAT* score match the sum of the values of a
??? Except by the wildest coincidence?
In your second post, you show this:
document.write('<img alt="random image" src="' + playerC[a] + '"/>');
Now, all of a sudden, you have introduced the array playerC
Where did *THAT* come from?
In the prior code, you had player
, but you certainly didn't have any playerC[ ]
On top of everything else, document.write
is badly obsolete and you should *NOT* be using it.