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

120
Vistas
Randomizing a movie title based on a movie genre

I am trying to create two buttons, one is to select a genre that you want to watch which I have shown below. The second one is to randomize a title based on the genre chosen. But I am a little lost on how I would take the value of the chosenMovieGenre function into another function. Any help would be appreciated.

     let changedGenre = document.getElementById('dropdown-movie').addEventListener('change', (event) => {
        
            fetch("https://movies-tvshows-data-imdb.p.rapidapi.com/?type=get_random-movies&page=1")
            .then(response => response.json())
            .then(function chosenMovieGenre(jsonObject) {
                let arrayGenres = jsonObject.movie_results
                arrayGenres.forEach((title) => {
                    let genreChosen = event.target.value
                    if (title.genres[0] === genreChosen){
                        // console.log(title.title)
                        return title.title 
                    }
                }) 
            })
        
            .catch(err => {
                console.error(err);
            });
    
    })
about 4 years ago · Juan Pablo Isaza
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