Okay.
So far, so good.
We got the first data cell inside of the table now, but now we need to get all of the data inside of
the table.
So how can we do that?
Well, we simply need to remove these nth child selectors we have up in our selector.
So if we take the same selector we had before and now we can remove the nth child up until the column
we have.
So up until here and here.
So we are sitting with this kind of selector, which is then going to select all of the table rows and
all of the table data cells.
So now if we try and say Enter here, we can see all of the names inside of the table all the way from
the first table row, because the first table, I mean from the second table row because the first table
row is elements, the table headers.
So it's not a TD element.
So basically it gets all of the elements, which is all of this, which is all the data from the table
anyway that we want to get.
And we simply print out all of the names.
But as you can notice here, we don't have any spaces besides the spaces we have between the names.
It just moves on to the next table cell.
And when you're dealing with this data inside of JavaScript and can be hard, it can be quite hard to
distinguish which one is which.
So you don't know which name belongs to which column.
You don't know if it's Alfred Fowler kissed Maria or it's.
If it's Alfred Fowler kissed.
You don't know.
You can't see that when the computer just has this long string with no spaces or anything between the
names.
But we can do something.
We can do a dot each loop for each of the elements that we get.
Now, the text like this just takes all of the elements text and just make one long string.
But if we want the cells to be from each line, then we have to make a loop instead for each of the
elements.
Anyway, it's probably going to make more sense when I write out the code here, so let's write it out.
So we have instead of the text, we have a dot each loop instead.
And this dot each loop have an index and an element inside.
So the index is just the index of this array of elements we have.
So index zero is the first element.
Index one is the next one and so on, and the element is the object itself.
Then we have this arrow function.
So this is just a function inside the loop.
And then we have a curly brace where we have the code we can write inside the loop.
And I made a enter here inside Chrome tools with shift insert to make a line break so that we don't
have this long, long one long line of code instead.
So it's a little easier for us to read it anyway.
Then we use the no, actually we do a console log.
And I will use the jQuery library.
Again, the dollar sign.
And we select this element that we have inside the loop and we get the text content from this element.
In this case, it's the first data cell and the second one and so on.
And then we close the function here inside the loop with the curly brace and then a parenthesis at the
end to close the each parenthesis we have up here.
And that's it.
Now let's try and press enter and see what the loop does.
You can see now all of the names inside of the table is printed out from the start to the last one at
the end, the UK.
So there we go.
So now we get all of the names and data inside of the table.
Now let's try and see the next section how we can do this inside of Node JS So we don't have to have
our browser open to scrape websites.