1
00:00:00,300 --> 00:00:06,510
You might also get a question regarding modular system, and they mean by this ActionScript six modules

2
00:00:06,510 --> 00:00:07,800
are common just modules.

3
00:00:08,100 --> 00:00:13,080
And for example, the question can be create and it must grip six module with functions.

4
00:00:13,080 --> 00:00:16,590
Get name, surname and default expert, get full name.

5
00:00:16,890 --> 00:00:22,560
And for this, you must know how modules are work in JavaScript just because it is the core component

6
00:00:22,560 --> 00:00:25,560
of JavaScript and we're using modules everywhere.

7
00:00:28,830 --> 00:00:33,660
And to use the inputs, we must create one more file, as you can see here, I have Manges.

8
00:00:33,810 --> 00:00:36,450
This is our main file and index each HTML.

9
00:00:36,720 --> 00:00:42,420
So let's say that we are creating a new module and we want to name it, for example, ActionScript six

10
00:00:42,600 --> 00:00:46,890
dot and instead we will write some ActionScript six module.

11
00:00:47,130 --> 00:00:52,710
So first of all, here we want to create a method to get name and variety in it with expert Konst.

12
00:00:52,710 --> 00:00:53,940
Here is get name.

13
00:00:54,240 --> 00:00:58,470
And here we are, getting as an argument name and were written in back our name.

14
00:00:58,800 --> 00:01:02,160
And as you can see here, we use the construction expert Konst.

15
00:01:02,370 --> 00:01:05,490
And this is exactly one of the functions that we must create.

16
00:01:05,760 --> 00:01:08,160
And as you can see, you get the name and gets her name.

17
00:01:08,310 --> 00:01:10,020
I just named functions.

18
00:01:10,230 --> 00:01:15,330
This is why we were writing them and we're experts in them from this module was expert Konst.

19
00:01:15,570 --> 00:01:19,230
So I will copy this line and paste here, and we must name it.

20
00:01:19,230 --> 00:01:24,960
Get surname here by getting our surname and we are just returning our surname.

21
00:01:25,350 --> 00:01:29,850
And the last thing that we must create is default expert, forgetful name.

22
00:01:30,060 --> 00:01:34,020
And if you don't know how to create default expert, this is expert default.

23
00:01:34,260 --> 00:01:39,050
And here we don't need to provide a name, which means here we directly have a function.

24
00:01:39,270 --> 00:01:44,850
In our case, maybe we can create it like this name and surname, and we're just going to coordinate

25
00:01:44,850 --> 00:01:45,540
it inside.

26
00:01:45,780 --> 00:01:50,310
So here we have a Nechama script 16, and we just call here to our functions.

27
00:01:50,520 --> 00:01:53,520
First of all, get name and we're passing inside name.

28
00:01:53,670 --> 00:01:55,680
After this, we have a space in here.

29
00:01:55,680 --> 00:01:59,760
We have a second function, gets our name, web biosensor name inside.

30
00:01:59,940 --> 00:02:07,050
Now our ActionScript 6GHz file is a module and it is completely isolated and only what we export it

31
00:02:07,050 --> 00:02:09,240
here is available outside.

32
00:02:09,510 --> 00:02:10,560
So let's use it now.

33
00:02:10,560 --> 00:02:17,340
We have here three functions must jump in our main chairs and here we must empower them and were inputting

34
00:02:17,340 --> 00:02:18,820
them like this input.

35
00:02:18,870 --> 00:02:24,690
Then we have brackets and inside what we're importing, it is get name korma, gets her name.

36
00:02:24,870 --> 00:02:29,700
And as you can see, my wife's editor already rolled from and here ActionScript six.

37
00:02:29,940 --> 00:02:33,540
And as you can see, it is, of course, black because we are not using this functions.

38
00:02:33,810 --> 00:02:36,990
This is why here I want to write, get name and where possible.

39
00:02:36,990 --> 00:02:42,360
And so for example, Jack, then we have here get surname and here will be special.

40
00:02:42,630 --> 00:02:46,050
And this is how we're importing and using name exports.

41
00:02:46,290 --> 00:02:48,180
So we're using here word import.

42
00:02:48,420 --> 00:02:51,420
Then brackets and inside named functions.

43
00:02:51,600 --> 00:02:54,180
In our case, get name gets a name from.

44
00:02:54,180 --> 00:02:58,080
And this is the path to our file ActionScript six digest.

45
00:02:58,380 --> 00:03:01,440
Now the question is how we can get our default export.

46
00:03:01,560 --> 00:03:07,530
And for this, we can write just directly after input, get full name and then comma.

47
00:03:07,800 --> 00:03:14,190
In this case, we will get our default export first and then named experts just with brackets afterwards.

48
00:03:14,490 --> 00:03:20,010
Now here, inside our console.log, we can use get full name and we're passing inside two strings.

49
00:03:20,220 --> 00:03:22,610
First of all, Jack and secondly Spiro.

50
00:03:22,800 --> 00:03:27,570
And now we can use this functions just like they were defined in this particular file.

51
00:03:27,870 --> 00:03:33,810
Now the question is how we can use ActionScript six module inside our HDMI out, and for this, we must

52
00:03:33,810 --> 00:03:35,280
jump inside our HTML.

53
00:03:35,430 --> 00:03:38,010
And here we have script with source manges.

54
00:03:38,310 --> 00:03:44,520
This is totally fine, but we must write here type module and then it will be imported like ActionScript

55
00:03:44,520 --> 00:03:45,180
six module.

56
00:03:45,390 --> 00:03:48,240
Now let's try to reload our page, as you can see.

57
00:03:48,240 --> 00:03:53,480
Actually, it worked, but we're getting an error and we're getting coarse error because this index

58
00:03:53,490 --> 00:04:00,330
such HTML can't really loud manges because you can't make a cross origin request from file.

59
00:04:00,600 --> 00:04:05,910
And this is actually a problem, because here I am using this source file just like normal indexes for

60
00:04:05,910 --> 00:04:06,690
HTML file.

61
00:04:06,990 --> 00:04:12,120
And if you are using some frontend framework like rectangular, you won't have such problem because

62
00:04:12,120 --> 00:04:13,590
you have modular systems.

63
00:04:13,590 --> 00:04:14,790
They're out of the box.

64
00:04:15,090 --> 00:04:20,550
But exactly for this specific case where I have plain indexes, your HTML, I must serve this index

65
00:04:20,700 --> 00:04:22,410
HTML like a web server.

66
00:04:22,590 --> 00:04:25,080
And for this there is a package which is called serve.

67
00:04:25,200 --> 00:04:26,010
You can install.

68
00:04:26,010 --> 00:04:31,590
It was known chess and as you can see now, it is available for me, just this index, which HTML on

69
00:04:31,590 --> 00:04:32,970
localhost three thousand.

70
00:04:33,300 --> 00:04:38,760
Now, as you can see, we don't have an error regarding cause, but we have a problem to load our ActionScript

71
00:04:38,760 --> 00:04:43,740
six file because actually, here we must put dodger's to load this file.

72
00:04:44,160 --> 00:04:49,440
Now we're not getting this error, and as you can see in console this, all functions are available

73
00:04:49,440 --> 00:04:49,800
fast.

74
00:04:50,010 --> 00:04:53,070
So here we can see Jack Sparrow and Jack Sparrow.

75
00:04:53,220 --> 00:04:58,860
And this means that we successfully imported these three functions was named expert and default expert

76
00:04:58,860 --> 00:05:02,190
from our module by using ActionScript six modules.

77
00:05:02,520 --> 00:05:08,040
Now we have a next question which must create exactly the same stuff with common just module.

78
00:05:11,200 --> 00:05:15,520
And if you don't know, common just model is typically used inside notice.

79
00:05:15,790 --> 00:05:21,370
This is why now I want to write our ActionScript six, just file with using of common chess.

80
00:05:21,430 --> 00:05:24,970
This is why I will copy, paste everything and create here in your file.

81
00:05:25,180 --> 00:05:31,000
Just name it Common Dog Chess, and we will write everything here in common just module.

82
00:05:31,010 --> 00:05:32,380
You can do the same.

83
00:05:32,410 --> 00:05:36,730
You can't have simultaneously a default expert and name experts.

84
00:05:36,880 --> 00:05:40,350
And this is because instead of expert const, we're right in here.

85
00:05:40,370 --> 00:05:45,160
Module dot experts dot get name and best sign in a function here.

86
00:05:45,460 --> 00:05:52,000
The main point is if we want to write a default expert, we're writing instead of expert default module

87
00:05:52,000 --> 00:05:53,890
dot experts equals.

88
00:05:54,010 --> 00:05:58,840
And here is our function, which means here we have a default input for our function.

89
00:05:58,960 --> 00:06:05,830
So what we can do in this case is just leave this cat name and get surname as private functions because

90
00:06:05,830 --> 00:06:09,940
we can't really explode them simultaneously with our default expert.

91
00:06:10,060 --> 00:06:14,230
And as you can see here, we have module experts just to have our default expert.

92
00:06:14,590 --> 00:06:19,150
Now we can jump directly in, yes and here import our default function.

93
00:06:19,360 --> 00:06:22,240
But to do this, we must use the required keyword.

94
00:06:22,510 --> 00:06:28,510
This is why here I want to write concert and we're getting the get full name and here equals require.

95
00:06:28,660 --> 00:06:32,110
And here is our path common, Jess or just common?

96
00:06:32,290 --> 00:06:35,740
Now I can jump inside console and write node manges.

97
00:06:36,070 --> 00:06:38,740
And obviously we're getting the message get name is not.

98
00:06:38,740 --> 00:06:43,000
Define it because here we are trying to console.log, get name and get surname.

99
00:06:43,270 --> 00:06:45,460
Now here I have just get full name.

100
00:06:45,610 --> 00:06:46,510
Let's try again.

101
00:06:46,630 --> 00:06:50,110
As you can see, we don't have any errors and we're getting checks better.

102
00:06:50,320 --> 00:06:55,540
If we really want to get all three functions, we must jump here and just use everywhere.

103
00:06:55,800 --> 00:06:59,950
Module dot experts dot and here will be our guest name.

104
00:07:00,160 --> 00:07:02,890
Now here will be a module dot experts.

105
00:07:02,890 --> 00:07:08,770
Dot gets their name and here we want module dot experts and here will be get full name.

106
00:07:08,980 --> 00:07:12,760
In this case, it will work and we will get our three functions.

107
00:07:13,030 --> 00:07:14,350
Now we have three experts.

108
00:07:14,350 --> 00:07:20,170
We can come back in Manchester and here instead of get full name, we can just do structure and get

109
00:07:20,170 --> 00:07:24,220
three functions get name, get surname and here get full.

110
00:07:24,220 --> 00:07:27,090
Name and number can uncommon this to consulates.

111
00:07:27,160 --> 00:07:33,460
Let's check this out and jump into console and run node mangers, and we still get in there to get name

112
00:07:33,460 --> 00:07:34,540
is not define it.

113
00:07:34,780 --> 00:07:40,090
But actually the problem here is that in so common, yes, we don't have a function, get name and get

114
00:07:40,090 --> 00:07:43,960
surname because actually we have them only in module experts.

115
00:07:44,200 --> 00:07:46,240
This is why this code won't work.

116
00:07:46,450 --> 00:07:49,090
We really need to, right, first of all, get name.

117
00:07:49,210 --> 00:07:54,490
And then after this module, experts don't get name and here equals get name.

118
00:07:54,730 --> 00:08:00,460
In this case, this function can also work, and we must do exactly the same for our get surname.

119
00:08:00,640 --> 00:08:03,820
So here will be const gets name and let's move it to the top.

120
00:08:04,120 --> 00:08:06,520
And now here is our experts get name.

121
00:08:06,670 --> 00:08:09,370
And now here we can get their name and birth.

122
00:08:09,370 --> 00:08:11,560
Sign in here our function get surname.

123
00:08:11,800 --> 00:08:17,890
In this case, all functions are available for us inside this file and also outside through module experts.

124
00:08:17,920 --> 00:08:18,880
Let's check this out.

125
00:08:19,150 --> 00:08:22,630
I am running Node Manges and we don't have any errors.

126
00:08:22,900 --> 00:08:27,490
So as you can see, we have two different variants ActionScript six and Common Chest.

127
00:08:27,730 --> 00:08:33,250
And if you coded all this questions, then the next question might be what is the difference between

128
00:08:33,250 --> 00:08:36,160
ActionScript six modules and common just modules?

129
00:08:39,430 --> 00:08:44,400
And actually, as they already said, common just modules are typically used inside node chess.

130
00:08:44,710 --> 00:08:50,860
This is the standard modular system for node chess ActionScript six modules we have in-browser.

131
00:08:51,070 --> 00:08:58,120
This is ActionScript six JavaScript, and actually you can use ActionScript six modules inside Node.js.

132
00:08:58,450 --> 00:09:00,760
This is just the sugar around requir.

133
00:09:01,000 --> 00:09:06,700
This is why if you assign ActionScript six modules inside node, just you know that inside you still

134
00:09:06,700 --> 00:09:10,870
have requir because it is mandatory for node chess and ActionScript.

135
00:09:10,870 --> 00:09:14,260
Six modules are, first of all, newer than common just modules.

136
00:09:14,440 --> 00:09:19,960
And secondly, they are static, which actually means you can peg this require inside if condition,

137
00:09:19,960 --> 00:09:26,260
for example, or inside for loop, but you can't really do it with input because input must be always

138
00:09:26,260 --> 00:09:26,830
on the top.

139
00:09:26,980 --> 00:09:31,480
And if input is not on the top, then it will bubble automatically to the top.

140
00:09:31,630 --> 00:09:37,030
When the JavaScript passes it, and this is actually much better, first of all, for safety and secondly,

141
00:09:37,030 --> 00:09:41,260
to implement different building tools on the top of ActionScript six modules.
