Jump to content

[SOLVED] array Nan, it is!


XpertWorlock

Recommended Posts

New to Javascript, so this could be a stupid error on my part.

 

 

How come this works? 

 

function giveCard()
{
return '5';
};

dealerCard[0] = giveCard();

document.getElementById("dealerCardPosition0").innerHTML = '<div id="dealerCard0" class="card" >' + dealerCard[0] + '</div>';

 

and this doesn't

 

function giveCard()
{
return (Math.random * 10);
};

dealerCard[0] = giveCard();

document.getElementById("dealerCardPosition0").innerHTML = '<div id="dealerCard0" class="card" >' + dealerCard[0] + '</div>';

Link to comment
https://forums.phpfreaks.com/topic/139685-solved-array-nan-it-is/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.