I was testing out javascript games and functions and on this particular example it keeps getting stuck after clicking on the play button, after I inspected the elements of the source code it showed me that error is in the two functions pasted below, however I dont know why are these exceptions given , any help would be greatly appreciated
function rollDice()
{
dicerolling.play();
die1Value = NaN;
die2Value = NaN;
showDice();
die1Value = Math.floor(1 + Math.random() * 6);
die2Value = Math.floor(1 + Math.random() * 6);
return die1Value + die2Value;
}
function showDice()
{
setImage( rollDie1Img, die1Value );
setImage( rollDie2Img, die2Value );
}
function setImage( dieImg, dieValue )
{
if ( isFinite ( dieValue ) )
dieImg.src = "images//" + dieValue + ".png";
else
dieImg.src = "images//blank.png";
}
the complete code is pasted here if needed :
the error given by chrome :
