21: Scores

21: Scores

// check score against high score
if(current_score>21){
 document.getElementById('gameStatus').innerHTML = 'Game Over! Score: '+current_score;
 alert('You have exceeded 21! Press OK to try again!');
 twenty1('Shuffle');
}
else if (current_score==21){
 high_score = 21;
 document.getElementById('gameStatus').innerHTML = 'You have scored <strong>21</strong>!';
 alert('You reached 21! Congratulations! Press OK to Play again!');
 twenty1('Shuffle');
}
else{
 // output current score and high score
  document.getElementById('scores').innerHTML = '<strong>HIGH SCORE:</strong> ' + high_score + '<br><strong>Current Score:</strong> ' + current_score;
}
Comments are closed.