Let me show you how I'm going to solve this particular challenge.
There are so many ways to go about this.
But for this scenario, the question has given us the blueprint, the way we should go about it, because
it has given us how we should structure the object.
If it wasn't provided, we can create a new type of object with different property names.
But here is a case which has given to us.
So let's get started.
It says that create an object called user.
The first scenario.
So solution here.
And cost per user is equal to my object.
The next step is I need to fill up these properties.
The first one is name and it says you should use John.
Next is the age which says we should use 30, comma and then location.
It also says that you should use New York.
New York City.
So New York.
New York.
Okay.
We are done with the first one.
The second one is that create a function to print the name and the property of the user.
So for this, we have two ways of adding the function.
We can do it inline or we can come up here and add the method to the object.
But let's make everything in one place.
So let's put the function inside.
Remember a function, we give it the key and then the value is going to be the actual function.
The function is called the print info.
So will come here and say print.
Info and semicolon, my normal function and then parentheses and my carry braces.
So here I need to print out those names.
Right.
So I just can console.log quickly.
I can just return from this function.
But it didn't specify whether we should console.log it or we should return it.
But let me give you the right way.
Let's return from this function.
Next is we should print out the name and then the age.
So here we have access of the name as this dart name and this dart edge.
So here, because I'm going to add a dynamic value inside a string or use temperature here and then
my dollar sign, then percentage sign.
I will say this dart the name and then.
Is.
Then dollar sign carry braces.
And then this third age.
Then our at sea years.
Ote.
So that is it.
So let me call the function.
Let's say call the function here.
Call the function or invoke the function.
So user dot print info.
Then I'll call the function as that because I'm returning and assigned to a variable.
So cost, let's say answer is equal to that.
So next is let me console that log the answer.
So let's have a look at the answer in the console.
So you see that now?
I have John is 30 years old.