As you can see in our console log, we do get all of the job descriptions, but we are only outputting
the job descriptions in our console log so far.
We're not saving it in our object.
Let's try and do that now in this section.
Let's save the description on a job dot description property.
And then let's see what this new array looks like when it's returned from the map function.
So that looks something like this.
We're just going to say job description equals description.
And let's return this job that's been modified a little bit.
Let's say jobs let's call it all jobs with descriptions that's returned from this all jobs dot map.
And after that, let me just, uh, silence this console log for a bit, and let's try and do a console
log of the all jobs with descriptions at the end of this function.
Let's do a node index.js and see what this looks like.
Huh.
So okay, so you can see here that we do get a lot of promises that's been pending or is pending.
Now when we did the console log inside here in the function.
Well it just prints out the description once.
This promise up here has been resolved.
But when we do use map here, uh, with the async call, well, it just returns all of these promises
that's pending, but it's quite easy to get around that we can just say something like, let's call
this.
With promises instead.
Or let's call it, just promises.
It's shorter.
And then let's say, uh, let's say we can say all job descriptions and then we can say await promise,
dot all.
And we pass in the all job descriptions promises here.
And then we can do a console log of all job descriptions.
Let's do a node index.js and see what this looks like.
So there we go.
Now we can see we get these nice objects here, which has the title, the URL and the description,
which is really great.
If you want to save it in a database like MongoDB, you can even save it in a relational database as
well if you want to do that.
But one thing to keep in mind though, is when we use this dot map function, the excuse is firing all
these 325 requests all at once.
So this is very fast, but you're also quite prone to be blocked from a website if you use this method,
because you fire off so many requests at once, you're firing off.
Um.
All requests at once.
So that's very prone to getting you blocked from a website because, for example, with the actual Craigslist
website, if you do this, you're going to get blocked from or banned from the website for 24 hours,
basically.
So there is a method to get around this and scrape not so aggressively and avoid getting blocked.
And that's what I'm going to show you in the next section.