Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

168
Visualizações
Value is getting undefined after passing it to other argument

I'm 6 weeks in to a html/css/javascript course and I need to build a movie filter using a switch statement. I'm stuck and I don't know what to do.

I wrote this code (could be complete garbage, don't blame the noob):

const radioButtons = document.querySelectorAll('[name="film-filter"]');

function addEventListeners() {

    for (let counter = 0; counter < radioButtons.length; counter++) {
        radioButtons[counter].addEventListener("change", event => {
            const radioValue = event.target.value;
            /* console.log(radioValue); */
            addHandleToChange();
        });

    };


};

function addHandleToChange(radioValue) {
    console.log(radioValue);
};

addEventListeners();

I'm trying to the pass the const radioValue to the second function, the addHandleToChange. In this function I want to create my switch statement so I can start filtering the big movie Javascript file they provided using the radioValue const. But the console keeps saying the radioValue is undefined. Functions have stupid names but I have to keep these names.

Hopefully my question kind of straight to the point. Thanks in advance!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

you need to pass radioValue to function, addHandleToChange(radioValue);

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda