js/app.js
// call this function after all the stuff happens to calculate winner and new bank roll
call this function after all the stuff happens to calculate winner and new bank roll
call this function after all the stuff happens to calculate winner and new bank roll
function calcTotals() {
  if (player.handTotal > 21) {
    hitButton.removeEventListener('click', playerHit);
    stayButton.removeEventListener('click', playerStay);
  } else if (dealer.handTotal > 21) {
    player.bankroll += bet * 2;
    handHistory(playerName, 'wins');
  } else if (player.handTotal === dealer.handTotal) {
    handHistory(playerName, 'pushes');
    player.bankroll += bet;
  } else if (player.handTotal === 21 && player.handArray.length === 2) {
    player.bankroll += bet * 2.5;
    handHistory(playerName, 'BlackJack!');
  } else if (player.handTotal > dealer.handTotal) {
    player.bankroll += bet * 2;
    handHistory(playerName, 'wins');
  } else {
    handHistory('Dealer', 'wins');
  }
  nextTurn();
}
function calcTotals ( ) { if ( player . handTotal > 21 ) { hitButton . removeEventListener ( 'click' , playerHit ) ; stayButton . removeEventListener ( 'click' , playerStay ) ; } else if ( dealer . handTotal > 21 ) { player . bankroll += bet * 2 ; handHistory ( playerName , 'wins' ) ; } else if ( player . handTotal === dealer . handTotal ) { handHistory ( playerName , 'pushes' ) ; player . bankroll += bet ; } else if ( player . handTotal === 21 && player . handArray . length === 2 ) { player . bankroll += bet * 2.5 ; handHistory ( playerName , 'BlackJack!' ) ; } else if ( player . handTotal > dealer . handTotal ) { player . bankroll += bet * 2 ; handHistory ( playerName , 'wins' ) ; } else { handHistory ( 'Dealer' , 'wins' ) ; } nextTurn ( ) ; }
call this function after all the stuff happens to calculate winner and new bank roll
call this function after all the stuff happens to calculate winner and new bank roll