Skip to content

Commit

Permalink
Update script.js
Browse files Browse the repository at this point in the history
  • Loading branch information
divyalaldinani authored Jan 13, 2024
1 parent 767ed5a commit 6a451da
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,4 +91,24 @@ holdBtn.addEventListener('click', function( ) {
}
changePlayer();
}
})
});
newBtn.addEventListener('click', function() {
currScore1.textContent = '0';
currScore2.textContent = '0';
totalScore1.textContent = '0';
totalScore2.textContent = '0';
if( player1.classList.contains('inactive') ) {
player1.classList.add('active');
player2.classList.add('inactive');
player1.classList.remove('inactive');
player2.classList.remove('active');
}
if( player1.classList.contains('win') ) {
player1.classList.remove('win');
player2.classList.remove('lost');
}
else if( player1.classList.contains('lost') ) {
player2.classList.remove('win');
player1.classList.remove('lost');
}
});

0 comments on commit 6a451da

Please sign in to comment.