0
1
00:00:00,660 --> 00:00:10,320
Now REPL stands for Read Evaluation Print Loop, and it basically allows you to execute code in bite sized
1

2
00:00:10,320 --> 00:00:15,930
chunks, just like what we did with the Chrome Developer Tools Console inside Chrome.
2

3
00:00:15,930 --> 00:00:21,270
We were able to write a single line of code and then hit enter and it would run that line of code and
3

4
00:00:21,270 --> 00:00:23,940
then we could run another line of code etc..
4

5
00:00:23,970 --> 00:00:31,830
So by installing Node, we also installed the Node REPL, and to access it all we do is write the command
5

6
00:00:31,920 --> 00:00:35,360
node inside the command line and hit enter.
6

7
00:00:35,550 --> 00:00:39,770
And once you see that little angle bracket, then you know you're inside the REPL.
7

8
00:00:40,020 --> 00:00:42,540
So here we can write code directly.
8

9
00:00:42,540 --> 00:00:46,480
So for example, I could write console.log
9

10
00:00:46,680 --> 00:00:52,960
(“Hey there!”), and if I hit enter then it will execute it straight away.
10

11
00:00:53,180 --> 00:00:58,820
And we should be pretty familiar with this already, as it works pretty much the same as our Chrome Console.
11

12
00:00:58,820 --> 00:01:08,060
So we can also execute other bits of code, for example 3 + 5 equals 8, or “Angela “ +
12

13
00:01:08,480 --> 00:01:12,800
“Yu” will be my name, Angela Yu, as a string.
13

14
00:01:13,070 --> 00:01:17,960
And it's also got short cuts, like, for example, if we didn't feel like writing out the entirety of console.log
14

15
00:01:17,960 --> 00:01:21,050
we can write con, tab,
15

16
00:01:21,230 --> 00:01:27,320
and if one tab doesn't give you any results, you can tab again and that will give you all the possible
16

17
00:01:27,320 --> 00:01:28,540
commands that you can use
17

18
00:01:28,540 --> 00:01:29,430
at this point.
18

19
00:01:29,660 --> 00:01:33,020
So you can use console, constructor, continue.
19

20
00:01:33,200 --> 00:01:34,640
So we want console.
20

21
00:01:34,700 --> 00:01:38,810
So console, and then we can write dot and I tap twice,
21

22
00:01:38,810 --> 00:01:41,790
then I can see all of the different possibilities. Now
22

23
00:01:41,810 --> 00:01:46,640
sometimes, while you're working in the command line, one of the most difficult things can be figuring
23

24
00:01:46,640 --> 00:01:49,830
out how to exit the process that you're currently in.
24

25
00:01:49,850 --> 00:01:57,740
Now, in order to exit the REPL, you can either say .exit and hit enter, or you can simply hit Control
25

26
00:01:57,740 --> 00:02:06,560
C twice. And in a lot of cases in the future, when we're running servers, or when we’re starting processes, Control C
26

27
00:02:06,770 --> 00:02:10,690
will usually get out of any process that you're running at that time.
27

28
00:02:10,820 --> 00:02:16,220
And if you wanted to clear your console, you can simply just write clear, and it will delete all of the
28

29
00:02:16,220 --> 00:02:17,710
previous commands.
29

30
00:02:17,720 --> 00:02:22,570
Now that was a little brief intro into what you can do using the Node REPL.
30

31
00:02:22,790 --> 00:02:28,520
Now in the next lesson, we're going to look at how you can use some native node modules, so packages of
31

32
00:02:28,550 --> 00:02:34,820
code, that's been bundled into Node that we can use to make our lives easier and to perform some really
32

33
00:02:34,820 --> 00:02:36,610
simple functionality.
33

34
00:02:36,650 --> 00:02:39,430
So for all of that and more, I'll see you on the next lesson.
