1
00:00:00,510 --> 00:00:00,800
All right.

2
00:00:00,800 --> 00:00:01,860
Welcome back.

3
00:00:01,860 --> 00:00:03,610
It's time for another exercise.

4
00:00:03,750 --> 00:00:08,130
This time we're going to get some practice with the note command as well as some of the command line

5
00:00:08,130 --> 00:00:12,000
basic commands and a nice review of javascript basics.

6
00:00:12,240 --> 00:00:13,650
I've typed up the instructions.

7
00:00:13,770 --> 00:00:18,030
Let me make this a little bigger and I'll go ahead and read out the exercise.

8
00:00:18,390 --> 00:00:21,880
So using the command line create a file named Echo.

9
00:00:21,990 --> 00:00:22,890
Yes.

10
00:00:23,190 --> 00:00:24,360
Inside the file.

11
00:00:24,420 --> 00:00:29,530
Write a function named Echo that takes two arguments a string and a number.

12
00:00:29,730 --> 00:00:32,290
It should then print out the string number.

13
00:00:32,340 --> 00:00:33,370
Number of times.

14
00:00:33,540 --> 00:00:35,400
I know that's worded terribly.

15
00:00:35,400 --> 00:00:39,420
I struggled for a while trying to come up with a better a better way of phrasing it but I think just

16
00:00:39,420 --> 00:00:44,160
taking a look at the examples helps to illustrate it more than anything I could say.

17
00:00:44,220 --> 00:00:46,610
So we call Ekko with a string.

18
00:00:46,610 --> 00:00:53,880
In this case Ecko with three exclamation points and then a number 10 and that should print out echo

19
00:00:54,060 --> 00:00:56,240
the string 10 times.

20
00:00:56,470 --> 00:01:01,980
And if I called the Echo function with the string tater tots and then the number three it should print

21
00:01:01,980 --> 00:01:02,160
out.

22
00:01:02,160 --> 00:01:04,130
Tater tots three times.

23
00:01:04,170 --> 00:01:05,520
So you need to define a file.

24
00:01:05,520 --> 00:01:06,810
Echo J S.

25
00:01:06,810 --> 00:01:11,820
Then define a function called echo inside the function and at the bottom of the function.

26
00:01:11,940 --> 00:01:17,340
Add these two examples just that you have some test cases and then the last thing you need to do is

27
00:01:17,340 --> 00:01:24,290
run the contents of that echo japes file using Knode as always Pozza video right now.

28
00:01:24,300 --> 00:01:32,660
Go ahead do this on your own and then I'll be back in a little bit with a solution.

29
00:01:32,820 --> 00:01:33,730
Let's get started.

30
00:01:33,990 --> 00:01:36,730
So we need to create a file named Echo.

31
00:01:36,880 --> 00:01:39,850
Yes so I'm going to do that right here.

32
00:01:39,870 --> 00:01:41,730
Touch echo.

33
00:01:41,880 --> 00:01:44,730
Yes and then inside the file.

34
00:01:44,730 --> 00:01:46,620
Write a function named Echo.

35
00:01:46,620 --> 00:01:50,270
So let's open up the file can see it here open

36
00:01:53,240 --> 00:01:57,510
and the first thing that we need to do is write a function named Echo that takes two arguments.

37
00:01:57,630 --> 00:01:58,660
Let's do that now.

38
00:01:58,800 --> 00:01:59,620
Function.

39
00:01:59,780 --> 00:02:09,510
I go and take an argument string and no just like that it should print out the string number number

40
00:02:09,510 --> 00:02:10,280
of times.

41
00:02:10,500 --> 00:02:16,800
So we know we need to have a cancel but log string in there somewhere and then we need to repeat this

42
00:02:16,800 --> 00:02:21,600
line cancel belt log number or Nome number of times.

43
00:02:21,900 --> 00:02:25,010
We could either use a while loop or a for loop to do this.

44
00:02:25,020 --> 00:02:27,900
I definitely prefer for loops so we'll do that here.

45
00:02:27,960 --> 00:02:32,590
So for and we can do this multiple ways we can start with.

46
00:02:33,150 --> 00:02:37,920
We can start with a variable equal to zero and go all the way up until we can start with a variable

47
00:02:37,950 --> 00:02:41,300
equal to numb and count backwards down to zero.

48
00:02:41,490 --> 00:02:47,440
We can start at an arbitrary number like 30 and then keep going until we hit 30 plus now.

49
00:02:47,670 --> 00:02:50,650
But I'm just going to start with I equal to zero.

50
00:02:52,080 --> 00:02:53,600
And then when do I.

51
00:02:53,790 --> 00:02:56,100
Is less than numb.

52
00:02:56,730 --> 00:02:59,830
And the reason that it's less than is that I'm starting at zero.

53
00:02:59,850 --> 00:03:05,670
If I wanted to I could start at 1 and go less than or equal to numb and then I'll just add one to I

54
00:03:05,680 --> 00:03:05,880
.

55
00:03:06,120 --> 00:03:13,710
And we're never going to use the variable all that we're doing is putting a constant log inside so we

56
00:03:13,710 --> 00:03:14,530
don't use.

57
00:03:14,640 --> 00:03:19,530
We're just every time going to cons. about lug strength.

58
00:03:21,330 --> 00:03:28,470
Now let's copy these two examples and just put them at the bottom and let's go ahead and try running

59
00:03:28,470 --> 00:03:29,100
this.

60
00:03:29,100 --> 00:03:35,490
So we need to save the file first and then we need to go to our command line make sure we see the file

61
00:03:35,490 --> 00:03:35,560
.

62
00:03:35,580 --> 00:03:39,090
I go through yes and then we run it with the command node.

63
00:03:39,450 --> 00:03:40,270
Echo.

64
00:03:40,500 --> 00:03:43,440
Yes and there we go.

65
00:03:43,740 --> 00:03:50,790
Let's see we have one two three four five six seven eight nine ten echoes and then we get tater tots

66
00:03:50,880 --> 00:03:53,090
three times.

67
00:03:53,220 --> 00:03:55,770
That's all we needed to do in the next video.

68
00:03:55,770 --> 00:03:58,490
There's one more exercise that's a little bit more challenging.

69
00:03:58,530 --> 00:03:59,220
Using an array
