1
00:00:02,100 --> 00:00:05,000
It's now time to practice what you learned

2
00:00:05,000 --> 00:00:06,650
and for that, attached you'll find

3
00:00:06,650 --> 00:00:09,024
this 'exercise.JS' file,

4
00:00:09,024 --> 00:00:11,500
which is a brand new JavaScript file,

5
00:00:11,500 --> 00:00:13,640
which you can add to your project folder

6
00:00:13,640 --> 00:00:16,128
by dragging and dropping it in there.

7
00:00:16,128 --> 00:00:20,570
And in that file, I've got some instructions for you.

8
00:00:20,570 --> 00:00:23,629
As a side note, these are all JavaScript comments,

9
00:00:23,629 --> 00:00:26,496
you add them by adding two forward slashes,

10
00:00:26,496 --> 00:00:29,180
and anything you write thereafter

11
00:00:29,180 --> 00:00:32,360
will not be interpreted as a command,

12
00:00:32,360 --> 00:00:34,500
but instead as just an annotation

13
00:00:34,500 --> 00:00:37,440
for you or other developers.

14
00:00:37,440 --> 00:00:39,943
But now let's move on to your concrete tasks.

15
00:00:39,943 --> 00:00:42,880
As you can see, I've got a couple of tasks here,

16
00:00:42,880 --> 00:00:44,750
and the first task is

17
00:00:44,750 --> 00:00:48,274
that you create three new variables; one variable

18
00:00:48,274 --> 00:00:51,967
that stores the name of an online course of your choice

19
00:00:51,967 --> 00:00:55,520
another variable that stores the price of that course,

20
00:00:55,520 --> 00:00:58,290
and a third variable that actually stores

21
00:00:58,290 --> 00:01:00,520
the three main goals that you might have

22
00:01:00,520 --> 00:01:02,950
when taking that course.

23
00:01:02,950 --> 00:01:04,540
So create these three variables

24
00:01:04,540 --> 00:01:07,230
and assign any values of your choice.

25
00:01:07,230 --> 00:01:10,170
Of course, think about the value types

26
00:01:10,170 --> 00:01:12,080
which you plan on using.

27
00:01:12,080 --> 00:01:16,840
Now, once you completed the first task, take these variables

28
00:01:16,840 --> 00:01:19,091
and output alert them

29
00:01:19,091 --> 00:01:21,973
as we also did it before in this section.

30
00:01:23,140 --> 00:01:24,870
Now in the third task,

31
00:01:24,870 --> 00:01:28,130
you will need to apply more of the things we learned.

32
00:01:28,130 --> 00:01:32,730
I now want you to group these variables together,

33
00:01:32,730 --> 00:01:35,340
and we did learn about a certain way of

34
00:01:35,340 --> 00:01:38,500
grouping related data together.

35
00:01:38,500 --> 00:01:40,883
So try grouping them together here,

36
00:01:40,883 --> 00:01:44,860
give them proper names, proper labels.

37
00:01:44,860 --> 00:01:49,860
And then once you did that, also still output their values.

38
00:01:50,800 --> 00:01:53,588
You can still use the alert function for that,

39
00:01:53,588 --> 00:01:58,588
but you will have to access your different values slightly

40
00:01:58,860 --> 00:02:02,223
differently than you did it before in steps one and two.

41
00:02:03,810 --> 00:02:06,527
Now in step four and task number four,

42
00:02:06,527 --> 00:02:11,180
I want you to also output the second element

43
00:02:11,180 --> 00:02:14,570
in your main goals, variable.

44
00:02:14,570 --> 00:02:16,210
Now in task number five,

45
00:02:16,210 --> 00:02:19,684
you should define your own command your own custom command,

46
00:02:19,684 --> 00:02:21,905
with any name of your choice

47
00:02:21,905 --> 00:02:26,160
that actually will use that main goals variable,

48
00:02:26,160 --> 00:02:28,800
and access and element by its identifier.

49
00:02:28,800 --> 00:02:31,670
So basically what we did in task number four,

50
00:02:31,670 --> 00:02:34,179
but, unlike in task number four,

51
00:02:34,179 --> 00:02:38,322
this custom command should now be a bit more flexible.

52
00:02:38,322 --> 00:02:43,178
The concrete identifier, which you access should be dynamic,

53
00:02:43,178 --> 00:02:46,990
there should be some way of providing a value when

54
00:02:46,990 --> 00:02:49,540
that custom command is executed.

55
00:02:49,540 --> 00:02:51,062
And you should then be able to

56
00:02:51,062 --> 00:02:55,174
execute the same command for different identifiers.

57
00:02:55,174 --> 00:02:58,750
The main goals variable also should be dynamic

58
00:02:58,750 --> 00:03:01,160
inside of that command code.

59
00:03:01,160 --> 00:03:04,680
This command should not just work with main goals,

60
00:03:04,680 --> 00:03:08,570
but actually with any list of values.

61
00:03:08,570 --> 00:03:12,390
And last but not least, this custom command should

62
00:03:12,390 --> 00:03:16,580
then when you execute it, provide the accessed value,

63
00:03:16,580 --> 00:03:19,867
so that in the place where you did execute

64
00:03:19,867 --> 00:03:22,330
the custom command, you can use

65
00:03:22,330 --> 00:03:24,160
that accessed value.

66
00:03:24,160 --> 00:03:26,960
So that list element, which was retrieved by

67
00:03:26,960 --> 00:03:28,323
that custom command.

68
00:03:29,870 --> 00:03:31,205
Now step number six,

69
00:03:31,205 --> 00:03:35,050
or task number six is to then use this custom command,

70
00:03:35,050 --> 00:03:37,720
which you did define in task number five

71
00:03:37,720 --> 00:03:42,609
and output alert the result four different values,

72
00:03:42,609 --> 00:03:44,133
different lists, maybe,

73
00:03:44,133 --> 00:03:48,808
and different identifiers of list items of your choice.

74
00:03:48,808 --> 00:03:50,700
At least executed once,

75
00:03:50,700 --> 00:03:53,829
but feel free to execute it more than once.

76
00:03:53,829 --> 00:03:56,454
Now these are my tasks for you,

77
00:03:56,454 --> 00:03:59,200
you can put your solution code or write

78
00:03:59,200 --> 00:04:01,700
into this exercise JS file.

79
00:04:01,700 --> 00:04:03,430
You should just make sure

80
00:04:03,430 --> 00:04:07,220
that this exercise JS file is then also being used

81
00:04:07,220 --> 00:04:09,360
in index HTML, (indistinct).

82
00:04:09,360 --> 00:04:13,430
Maybe instead of app JS, or in addition, that's up to you.

83
00:04:13,430 --> 00:04:17,550
And definitely try this exercise on your own first.

84
00:04:17,550 --> 00:04:20,779
In the solution video, I will show you my solution

85
00:04:20,779 --> 00:04:22,240
and I do recommend that you go

86
00:04:22,240 --> 00:04:25,660
through that video also to compare your solution,

87
00:04:25,660 --> 00:04:27,190
and also if you get stuck

88
00:04:27,190 --> 00:04:29,710
and you're not sure how to solve something.

89
00:04:29,710 --> 00:04:32,370
Because there I'll show you how I solved this

90
00:04:32,370 --> 00:04:35,510
and that will then be another great exercise,

91
00:04:35,510 --> 00:04:37,803
but definitely try it on your own first.

