Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

173
Vistas
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 Respuestas
Responde la pregunta

0

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

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda