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

121
Visualizações
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 à 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