Home > Enterprise >  Failed to use map function in the right way within google apps script
Failed to use map function in the right way within google apps script

Time:12-25

I can't use map function in the right way within google apps script while scraping two fields—movie name and image— from a output

But since you aren't returning anything, just use each as mentioned by Sysix.

Note:

  • For some reason, execution doesn't end if I return both values into result when using map and trying to log result.
  • I tested another way to store the data and the script below worked.
var result = [];
container.each((index, item) => {
  const movieName = $(item).find('a.browse-movie-title').text();
  const movieImage = $(item).find('img.img-responsive').attr('src');
  result.push([movieName, movieImage]);
});
console.log(result);

output2

  • Related