Skip to content

Commit

Permalink
fut : btn even listener
Browse files Browse the repository at this point in the history
  • Loading branch information
Nishanthnaa52 committed Jun 2, 2024
1 parent cbf9723 commit b883ce0
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,6 @@ document.querySelector('.js-scissors-btn').addEventListener('click', () => {
});





// auto play function section.

const autoButton = document.querySelector('.auto-button');
Expand Down Expand Up @@ -156,4 +153,18 @@ function autoPlay() {

document.querySelector('.js-auto-btn').addEventListener('click',() => {
autoPlay();
});
});


document.body.addEventListener('keydown', (event) => {
if (event.key === 'r') {
finalResult('rock');
}else if (event.key === 'p') {
finalResult('paper');
}else if (event.key === 's') {
finalResult('scissors');
}
// else {
// alert('Useing P, R, S to controlling.');
// }
});

0 comments on commit b883ce0

Please sign in to comment.