0
1
00:00:00,000 --> 00:00:02,941
Okay so let's work on the
story. So first we have to
1

2
00:00:02,941 --> 00:00:06,301
create a fire spell array and a
frost spell array containing
2

3
00:00:06,301 --> 00:00:10,461
respectively firebolt firewall
and frostbolt and blizzard. So
3

4
00:00:10,461 --> 00:00:13,501
I think we already created
these. We just have to add
4

5
00:00:13,501 --> 00:00:17,981
other ones. So fire spell we
have the firebolt and we just
5

6
00:00:17,981 --> 00:00:23,661
screw in to create another one.
Firewall. And here we're just
6

7
00:00:23,661 --> 00:00:27,661
going to add a frostbolt.
7

8
00:00:29,721 --> 00:00:37,341
So here we are good create a
fire wizard and initialize it
8

9
00:00:37,341 --> 00:00:42,141
with the fire spell array sure
no problem so we have a wizard
9

10
00:00:42,141 --> 00:00:50,281
and we're going to initialize
it with a fire spell Okay. Okay
10

11
00:00:50,281 --> 00:00:55,801
create a frost wizard so let's
do the same thing with the
11

12
00:00:55,801 --> 00:01:04,401
frost wizard and I'm going to
call this one fire wizard and
12

13
00:01:04,401 --> 00:01:06,481
this one will be
initialized with the frost
13

14
00:01:06,481 --> 00:01:10,961
bells going to remove that
14

15
00:01:11,721 --> 00:01:19,901
just all the fire wizard spell
at once. So fire wizard. just
15

16
00:01:19,901 --> 00:01:22,781
all at once.
16

17
00:01:24,221 --> 00:01:28,001
Cast a big bang from the fire
wizard spell book and if you
17

18
00:01:28,001 --> 00:01:32,081
throw the error catch it so
indeed there is no big bang in
18

19
00:01:32,081 --> 00:01:35,121
this spell book okay in the
Fire Wizard spell book so
19

20
00:01:35,121 --> 00:01:38,881
technically it should crash so
let's make sure first that it's
20

21
00:01:38,881 --> 00:01:44,081
crashing fire wizard that cast
from spell book and then fire
21

22
00:01:44,081 --> 00:01:52,321
spell name. Big Bang so let's
see It seems that it is
22

23
00:01:52,321 --> 00:01:58,181
crushing indeed. You don't have
this spell in your spell book
23

24
00:01:58,181 --> 00:02:00,421
so we just have to catch this
error this way the application
24

25
00:02:00,421 --> 00:02:05,301
doesn't crash so means that
it's working so we're going to
25

26
00:02:05,301 --> 00:02:08,901
surround this by a try/catch
26

27
00:02:09,721 --> 00:02:14,301
try catch here we have the
error that is of type unknown
27

28
00:02:14,301 --> 00:02:19,501
for now and we're going to
console.log error and we're
28

29
00:02:19,501 --> 00:02:23,341
going to cast that as an error
29

30
00:02:25,221 --> 00:02:29,241
And this way we know that there
is a message inside. And I'm
30

31
00:02:29,241 --> 00:02:35,601
going to write error before.
And technically error you don't
31

32
00:02:35,601 --> 00:02:42,221
have the spell in your spell
look so it's working fine cool
32

33
00:02:42,221 --> 00:02:46,941
Now cast all the frost wizard
spell at once. So this one is
33

34
00:02:46,941 --> 00:02:55,901
easy. Frost wizard. cast all at
once. Okay, everything seems to
34

35
00:02:55,901 --> 00:03:02,501
work fine. And finally cast a
blizzard spell from the frost
35

36
00:03:02,501 --> 00:03:06,581
wizard spell book so this one
should work because we have the
36

37
00:03:06,581 --> 00:03:12,901
blizzard in the spell book so
frost wizard.cast from spell
37

38
00:03:12,901 --> 00:03:15,141
book
38

39
00:03:17,221 --> 00:03:25,981
frost spell name.blizzard
and Blizzard. Yep. It's
39

40
00:03:25,981 --> 00:03:31,901
working. Okay so we are good
with the story. Great. Uh okay
40

41
00:03:31,901 --> 00:03:35,181
cool so good job doing this
exercise. Uh now in the next
41

42
00:03:35,181 --> 00:03:41,341
video I'm just going to show
you how to specifically type or
42

43
00:03:41,341 --> 00:03:45,741
is it again? Yep. This. Okay?
Like I told you we can send
43

44
00:03:45,741 --> 00:03:49,101
anything and we want to
restrict that to either fire
44

45
00:03:49,101 --> 00:03:52,541
spell names or frost spell
names depending on the type of
45

46
00:03:52,541 --> 00:03:56,161
the wizard. So in the we're
going to see that we can
46

47
00:03:56,161 --> 00:04:00,561
actually create types
conditionally. So let's do that
47

48
00:04:00,561 --> 00:04:03,385
in the next one.
