const playerTwo=()=>{
computer.classList.add("hide");
userTwo.classList.remove("hide");
score.forEach((score)=>{
score.addEventListener("click",()=>{
const userOneScore=score.getAttribute("id");
console.log("player one choice=",userOneScore);
if(userOneScore==="user-1")
{
choice.forEach((choice) => {
choice.addEventListener("click",()=>{
console.log("clic by player one");
let userOneChoice=choice.getAttribute("id");
console.log("player one choice=",userOneChoice);
})
});
}else if(userOneScore==="user-2"){
choice.forEach((choice) => {
choice.addEventListener("click",()=>{
console.log("clic by player Two");
let userTwoChoice=choice.getAttribute("id");
console.log("player two choice=",userTwoChoice);
})
});
}
})
})
}
player one choice= user-1
app.js:116 clic by player one
app.js:118 player one choice= paper
app.js:110 player one choice= user-2
app.js:116 click by player one
app.js:118 player one choice= scissors
app.js:12 click by player Two
app.js:126 player two choice= scissors
New contributor
juhee katira is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
2