0

I want to return value of "event.target.innerText" from pC to playerChoice and then use it.

const buttons = document.querySelectorAll("button");
const playerChoice = buttons.forEach(button => {
    button.addEventListener("click", event => {
        const pC = (event.target.innerText).toLowerCase();
        return (pC);
    });
});

i tried this where i am passing the value into function and it worked but i just want to expand my knowledge so just looking for some extra approach

Diggi
  • 1

0 Answers0