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

171
Views
How do I store the value returned by the API response in a variable?

showMovies() is a function that gets an array of movie information that holds imdbID, Title, etc. Then for each movie, I have to call a different API call via its IMDbID to fetch more details like the Plot. But if I print Overview inside the fetch it is printing the details correctly

see output

but outside that, it is printing nothing to console

see output.

'Overview' is a global variable

function showMovies(data){
data.forEach(movie => {
    const{Title,Poster,imdbID,Year,Type} = movie;
    url=BASE_SEARCH_MovieInfo+imdbID+API_KEY;
    fetch(url).then(res => res.json()).then(m_data =>{
    Overview = m_data.Plot;
    console.log(Overview);
    // Overview = Plot;
    });

});

}

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!