All right.
Let me show you how I'm going to solve this particular challenge.
Well, this challenge didn't specify the format of the object.
How you supposed to make it so we can create any object?
Okay.
So let's go by using the user object.
Okay.
You can make a book object or let's use book object for this time.
Okay.
So let's say cast book.
Object is equal to.
And now let's say the name of the book is called.
Web development.
Development Guide.
You name the book and then let's see, the author of the book is I Knew Take.
Academy.
And then we can say number of pages.
So number of pages.
Let's say it's go to 5000 pages and then we can say the ISBN of the book is b, b, n, let's say quoting
i n to file for it can be anything here as matter.
So now we are finished creating our object.
So the next one is what?
Let's create a function to iterate over this particular object.
So let me have my comment here and I will call this one solution solution.
And then the next one is my function, right?
So const I'm going to use function expression.
So const print object, print object.
Okay is equal to my function parentheses and my carry braces.
This function will take in the object I'm going to pass into address over now inside.
Remember, how can we get the properties of an object where have two ways of doing it?
You can get you can use the object dot keys and then you can use the for loop to loop through them.
But we have one method that going to make our life easier and that is for in loop.
So for a next is let's is a special keyword and then a key is what I'm specifying or I want in my object
that are passed in in the object when I call this particular function.
And now inside I can cancel that, log back, take here my keys and my value.
I write my keys and my value.
So before I move on, let's try to console that log.
The object there are passed in.
For the meantime, let's move step by step here.
Next is let me call the function called print object.
Then I'll pass in my book object.
That's what I'm trying to get.
So if I save it now, check it out here.
We have some beautiful result here because this one, it has printed out all the values here because
let's have a look at the final one so that we have the object is the original object I pass in, which
is this particular one.
Which is this one.
Let me show you here.
This object is the object passing here and this object is this one.
That's why I have them in my console as that.
Did you get it?
Yes.
So what about the keys?
Okay, so if I console the keys to here.
If I console the keys, the keys represent this one's name, author pages and ISBN.
So you see that I have the keys here, but I also want to console.log the value also.
How am I going to get it?
And remember guys, if we have the keys here, we can use the object and the key to get the value because
the question says that we should print out the format, the key semicolon and the value.
Meaning if you print out the key and a value in the console and here we have the key, what about the
value?
Remember how we can get I mean, properties of an object.
You can use the dot notation or the square bracket.
So for this one, okay, if I make use of objects here, then I say dot name.
Let's see.
Now you see that we got what?
Web Development Guide?
That's the name of the book.
So if I also want the title, let's say the author is going to be the author of the book.
Let her look.
Yes.
That we have the book title.
And then the more you call it the the author of the book.
So if I want those values, unless I duplicate many codes like this one with a dot notation, then I
will say ISBN and then the number of pages.
Now of pages if I save it, see that I have them being printed in in the console.
So with this one, see that is making our life difficult.
Assuming we have, let's say, 20 properties here, are we going to console.log everything here?
That is why the bracket notation is really shine over here because with the bracket notation for getting
the value from an object, it makes it more dynamic.
So we are going to use that method because for that one, we're going to make it more flexible.
Okay.
So we can take now let's remove this one.
So instead of using the dot notation, you're going to use the square bracket.
And now I'm going to pass in the dynamic key, which is this one you see.
So with this key is something like the object dot key and the key represent this one.
Okay.
So it's going to be the object dot key, which is this.
Now this one is more dynamic.
So if I console.log this one, you see that I have the values inside here.
So what about the property?
The key is really simple.
I have the key here already.
So one line of code using the this square bracket, I have the properties being console.log and then
using the dot notation to repeat how many times?
One, two, three, four times.
So now I have this one so I can now use mine.
Let me cut from here for the mean time use but take then main the dollar sign.
Kerberos is in the key.
Okay.
Then I'll make a semicolon.
And then.
Mandela saying you now pace my lesson, but not this one.
Let me start from scratch here.
My dollar sign, percentage sign, my army cape raises, then my object, and then I'll pass in the
key manuscript record.
And then the key.
And that is it.
So if I save it, let's see.
Indeed, we have achieved what we are supposed to do.
We have the name semicolon and the property name and the value.