Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

119
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!