I have a challenge for you in this lesson, it's to create an array that contains objects created dynamically
using a loop, so output the content into the console.
So it looks like the example on the right hand side.
So create this using a loop.
And we saw how we can create an array as well as how we can create objects.
Also use the filter to create a new array only with the items that have the value of true.
So first, we're setting up a value for my work and this is going to be an array.
And then using a loop, we're going to start the loop at one and we're going to loop through while X
is less than ten and then increment X by one.
And we want to push a value into my work.
So this isn't a race or using their race method, it will create a variable that's going to contain
a value for temp.
So for now, we'll just equal temp.
So set up temp within this loop.
And we're going to equal attempt to whatever the value of access for, let's console logout the contents
of my work.
So you can see that we constructed our array and it's got all of the different values, so starting
at index zero, so one all the way to nine, let's extend on that and create an object.
So we're checked to see if X modulus is equal to true or false.
So depending on if it's odd or even we're going to have a different value for stat.
And then as we're pushing as we're constructing temp, we're going to create temp into an object that's
going to have a name and the name for this object, we can use a template literal for lesson.
You can have concatenate it as well together.
So there is a few options there and then status will just be equal to stop.
So now we can see the contents of the array going to be all these objects can filter them, construct
a brand new array.
So taking our get the ones that are true, we're going to look through the my work array and use filter,
which is going to create a new array.
So just as we did before returning back, that element value and we're returning back the element with
a status and because status is a boolean value.
So it's only going to return back the true ones.
So if we cancel, log out the get true array, you're going to see that we're only containing the objects
that are true, that are available within the array that was constructed.