1
00:00:01,200 --> 00:00:05,430
Let me show you how I'm going to solve this particular challenge.

2
00:00:06,650 --> 00:00:09,140
There are so many ways to go about this.

3
00:00:09,320 --> 00:00:17,750
But for this scenario, the question has given us the blueprint, the way we should go about it, because

4
00:00:17,750 --> 00:00:22,730
it has given us how we should structure the object.

5
00:00:23,150 --> 00:00:29,960
If it wasn't provided, we can create a new type of object with different property names.

6
00:00:29,960 --> 00:00:32,479
But here is a case which has given to us.

7
00:00:32,479 --> 00:00:34,310
So let's get started.

8
00:00:34,670 --> 00:00:38,780
It says that create an object called user.

9
00:00:38,810 --> 00:00:40,220
The first scenario.

10
00:00:40,220 --> 00:00:42,020
So solution here.

11
00:00:42,890 --> 00:00:48,540
And cost per user is equal to my object.

12
00:00:48,560 --> 00:00:52,850
The next step is I need to fill up these properties.

13
00:00:53,330 --> 00:00:57,860
The first one is name and it says you should use John.

14
00:00:59,710 --> 00:01:07,120
Next is the age which says we should use 30, comma and then location.

15
00:01:07,270 --> 00:01:10,960
It also says that you should use New York.

16
00:01:10,960 --> 00:01:12,040
New York City.

17
00:01:12,050 --> 00:01:14,080
So New York.

18
00:01:14,080 --> 00:01:16,360
New York.

19
00:01:17,450 --> 00:01:18,080
Okay.

20
00:01:18,170 --> 00:01:20,060
We are done with the first one.

21
00:01:20,540 --> 00:01:27,740
The second one is that create a function to print the name and the property of the user.

22
00:01:28,070 --> 00:01:31,520
So for this, we have two ways of adding the function.

23
00:01:31,520 --> 00:01:38,890
We can do it inline or we can come up here and add the method to the object.

24
00:01:38,900 --> 00:01:41,740
But let's make everything in one place.

25
00:01:41,750 --> 00:01:43,630
So let's put the function inside.

26
00:01:43,640 --> 00:01:51,250
Remember a function, we give it the key and then the value is going to be the actual function.

27
00:01:51,260 --> 00:01:54,140
The function is called the print info.

28
00:01:54,230 --> 00:01:56,960
So will come here and say print.

29
00:01:58,110 --> 00:02:06,960
Info and semicolon, my normal function and then parentheses and my carry braces.

30
00:02:07,290 --> 00:02:11,340
So here I need to print out those names.

31
00:02:11,580 --> 00:02:11,810
Right.

32
00:02:11,820 --> 00:02:13,740
So I just can console.log quickly.

33
00:02:13,750 --> 00:02:16,230
I can just return from this function.

34
00:02:16,560 --> 00:02:21,000
But it didn't specify whether we should console.log it or we should return it.

35
00:02:21,000 --> 00:02:23,670
But let me give you the right way.

36
00:02:23,790 --> 00:02:25,620
Let's return from this function.

37
00:02:25,950 --> 00:02:30,930
Next is we should print out the name and then the age.

38
00:02:30,930 --> 00:02:38,040
So here we have access of the name as this dart name and this dart edge.

39
00:02:38,310 --> 00:02:46,200
So here, because I'm going to add a dynamic value inside a string or use temperature here and then

40
00:02:46,200 --> 00:02:49,620
my dollar sign, then percentage sign.

41
00:02:49,620 --> 00:02:55,380
I will say this dart the name and then.

42
00:02:56,630 --> 00:02:57,410
Is.

43
00:02:58,370 --> 00:03:01,520
Then dollar sign carry braces.

44
00:03:01,520 --> 00:03:05,840
And then this third age.

45
00:03:05,960 --> 00:03:09,290
Then our at sea years.

46
00:03:10,950 --> 00:03:11,670
Ote.

47
00:03:11,670 --> 00:03:12,840
So that is it.

48
00:03:12,930 --> 00:03:14,820
So let me call the function.

49
00:03:14,820 --> 00:03:16,860
Let's say call the function here.

50
00:03:18,360 --> 00:03:20,940
Call the function or invoke the function.

51
00:03:20,940 --> 00:03:24,360
So user dot print info.

52
00:03:24,390 --> 00:03:30,570
Then I'll call the function as that because I'm returning and assigned to a variable.

53
00:03:30,600 --> 00:03:36,150
So cost, let's say answer is equal to that.

54
00:03:36,420 --> 00:03:40,230
So next is let me console that log the answer.

55
00:03:40,230 --> 00:03:42,780
So let's have a look at the answer in the console.

56
00:03:42,780 --> 00:03:43,710
So you see that now?

57
00:03:43,710 --> 00:03:47,460
I have John is 30 years old.

