MCPcopy Create free account
hub / github.com/Vishal-raj-1/Awesome-JavaScript-Projects / switchPlayer

Function switchPlayer

assets/js/diceit.js:37–44  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

35initial();
36
37const switchPlayer = function(){
38 document.getElementById(`current--${activePlayer}`).textContent = 0;
39 currentScore = 0;
40 activePlayer = activePlayer == 0 ? 1 : 0;
41 player0El.classList.toggle('player--active');
42 player1El.classList.toggle('player--active');
43
44}
45btnRoll.addEventListener('click', function(){
46 if(playing){
47 const dice = Math.trunc(Math.random()*6)+1;

Callers 1

diceit.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected