Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,330 --> 00:00:00,930
Welcome back.
2
00:00:01,590 --> 00:00:05,400
So we just learned what note is kind of.
3
00:00:05,580 --> 00:00:12,360
We're still working there, but the other piece of information that we need to solve is what is a JavaScript
4
00:00:12,510 --> 00:00:13,080
runtime?
5
00:00:13,500 --> 00:00:16,680
Because Node is a JavaScript runtime.
6
00:00:16,800 --> 00:00:19,200
It's not a programming language, it's not a framework.
7
00:00:19,380 --> 00:00:20,760
It's a runtime.
8
00:00:21,450 --> 00:00:23,430
So let's demystify that.
9
00:00:24,330 --> 00:00:25,500
What is a runtime?
10
00:00:26,280 --> 00:00:31,450
Now this idea of a runtime, we're going to deep dive into it a little bit later in the course.
11
00:00:31,470 --> 00:00:38,820
So I'm just going to skim the surface, but you can think of it as a JavaScript environment, an environment
12
00:00:38,820 --> 00:00:43,080
that allows us to run JavaScript as well as do some extra stuff.
13
00:00:43,590 --> 00:00:50,040
Now the way node works is that it has the V8 engine, which, as we learned, makes our JavaScript code
14
00:00:50,220 --> 00:00:51,660
run really efficiently.
15
00:00:52,630 --> 00:01:00,940
And every time the Google engineers upgrade the V8 engine, which is very often well know, it automatically
16
00:01:01,180 --> 00:01:04,900
gets faster and faster with each improvement in the V8 engine.
17
00:01:05,230 --> 00:01:08,230
So automatic performance boost just by that.
18
00:01:08,890 --> 00:01:14,500
But in order for it to do a lot more than just write JavaScript, it might want to do different things.
19
00:01:14,500 --> 00:01:21,070
Maybe read files, maybe access databases, maybe just run.
20
00:01:21,070 --> 00:01:25,360
Some things that aren't part of the V8 engine aren't part of JavaScript.
21
00:01:25,990 --> 00:01:29,140
And that's where this Lib U.V. comes in.
22
00:01:29,920 --> 00:01:39,700
You see, no GS in a simplified form is simply a way for us to give a JavaScript file to the Node.js
23
00:01:39,700 --> 00:01:40,120
runtime.
24
00:01:40,480 --> 00:01:43,310
It's going to go through the V8 engine.
25
00:01:43,330 --> 00:01:44,830
It's going to read the JavaScript.
26
00:01:44,980 --> 00:01:51,250
And any time it sees something that maybe isn't part of JavaScript, it's going to communicate with
27
00:01:51,400 --> 00:01:55,450
this Lib U.V. library with a cool dinosaur logo.
28
00:01:55,570 --> 00:01:56,830
But what does it mean?
29
00:01:57,550 --> 00:01:57,970
Well.
30
00:01:59,440 --> 00:02:02,780
We can just simply Google Lib UAV.
31
00:02:05,040 --> 00:02:11,910
Libya V is a multi-platform C library that provides support for asynchronous i o based on event loops.
32
00:02:12,030 --> 00:02:14,070
Don't worry, we'll cover that later in the course.
33
00:02:14,610 --> 00:02:22,350
It's essentially a library that allows us to do some really neat features with Node.js that make it
34
00:02:22,350 --> 00:02:27,270
great for things like web servers, things that we're going to build throughout the course.
35
00:02:28,110 --> 00:02:35,040
If we actually go to the Node.js GitHub repo, which anybody can access because it's open source and
36
00:02:35,040 --> 00:02:40,770
we go into the source folder, you'll actually see that at the bottom.
37
00:02:42,980 --> 00:02:49,280
We're going to access the red meat that says no eggs, C++ code base, and you can read about this if
38
00:02:49,280 --> 00:02:50,540
you really want to dive deep.
39
00:02:51,260 --> 00:02:58,910
But essentially, what Node and Brian Dahl did was combine the V8 engine and this Lib UAV, which is
40
00:02:58,910 --> 00:03:06,680
written in C++ V8 engine is written with JavaScript and C++, and he created the bindings between them
41
00:03:06,680 --> 00:03:13,490
so that they can communicate so that whenever they encounter something that maybe needs asynchronous
42
00:03:13,490 --> 00:03:17,630
Io, well, then we hand it over to the Lib UAV.
43
00:03:18,230 --> 00:03:24,110
Now I know this is kind of confusing, and we're going to dive deeper into this topic, but that's one
44
00:03:24,110 --> 00:03:30,470
note it's a JavaScript runtime is an environment for us to run JavaScript that gives us a little bit
45
00:03:30,470 --> 00:03:32,300
more than just the V8 engine.
46
00:03:33,680 --> 00:03:35,060
Now, let me ask you another question.
47
00:03:35,810 --> 00:03:39,350
Is a Web browser a JavaScript runtime?
48
00:03:40,360 --> 00:03:45,610
Pause the video and think about it based on what you learned is JavaScript runtime.
49
00:03:47,060 --> 00:03:49,490
Well, let's do a quick search here.
50
00:03:50,550 --> 00:03:55,110
Is Web browser a JavaScript?
51
00:03:57,000 --> 00:03:59,610
Runtime, well, good sentencing on my part.
52
00:04:01,910 --> 00:04:06,630
All right, so we go to StackOverflow, looks like this person has the exact same question as us.
53
00:04:07,010 --> 00:04:11,120
And if we go to the answer, we see a browser contains a JavaScript engine.
54
00:04:11,160 --> 00:04:12,500
Hey, we know what that means.
55
00:04:13,070 --> 00:04:19,550
And the engine implements a JavaScript runtime, which includes call stack heap and event loop.
56
00:04:19,820 --> 00:04:21,800
Don't worry, we're going to learn about those soon.
57
00:04:22,250 --> 00:04:29,300
The browser also usually includes a set of APIs that augment the JavaScript runtime and make asynchronous
58
00:04:29,300 --> 00:04:31,070
blah blah blah blah blah blah blah, blah blah.
59
00:04:31,700 --> 00:04:36,380
In a sense, yes, the web browser is a JavaScript runtime, right?
60
00:04:36,950 --> 00:04:43,400
If we go to our console, we can actually run code that isn't part of JavaScript.
61
00:04:43,940 --> 00:04:50,300
For example, console dialog isn't actually part of the JavaScript Spec. It's just something that the
62
00:04:50,300 --> 00:04:54,110
browsers allow us to do things like alert.
63
00:04:55,510 --> 00:05:03,760
Well, those are very Web specific, the browser implements this alert feature that we can use and all
64
00:05:03,760 --> 00:05:04,270
of these.
65
00:05:06,250 --> 00:05:14,680
Are part of what we call the window object in the browser, the window object is a set of tools that
66
00:05:14,680 --> 00:05:21,670
the browsers give us that we can use that aren't part of JavaScript, but allow us to have multiple
67
00:05:21,670 --> 00:05:22,580
functionalities.
68
00:05:22,930 --> 00:05:24,610
So it's a JavaScript runtime.
69
00:05:24,760 --> 00:05:32,830
Remember the V8 engine combined with some extra functionality in the same sense with Node.js?
70
00:05:33,460 --> 00:05:38,390
We have that functionality, except because it's not a browser énergies.
71
00:05:38,500 --> 00:05:42,230
If you do window, you're going to get an error in Node.js.
72
00:05:42,250 --> 00:05:46,090
We have something called global instead of the window.
73
00:05:46,390 --> 00:05:52,210
But if I do it here, I get an error because the browser doesn't know about global.
74
00:05:52,660 --> 00:05:56,260
Don't worry, we're going to dive into this specific thing in the next video.
75
00:05:56,650 --> 00:06:01,720
But before I keep talking and keep talking, I want to go back to what we've learned.
76
00:06:01,750 --> 00:06:02,500
Up until now.
77
00:06:04,360 --> 00:06:06,340
How do you run JavaScript?
78
00:06:06,760 --> 00:06:08,950
Well, you need a runtime.
79
00:06:09,460 --> 00:06:15,310
You need some sort of an JavaScript engine and a runtime to be able to run the code, and that's what
80
00:06:15,550 --> 00:06:16,210
no does.
81
00:06:16,660 --> 00:06:20,290
So how do you run JavaScript outside of the browser?
82
00:06:20,740 --> 00:06:27,130
You need to download a set of features so that your computer understands what JavaScript is, why you
83
00:06:27,130 --> 00:06:27,670
want to do.
84
00:06:28,690 --> 00:06:36,130
Node is, in a way, just a set of tools for us to write our applications.
85
00:06:37,470 --> 00:06:44,460
That application uses the V8 engine to read the JavaScript, and any time there's something that requires
86
00:06:44,700 --> 00:06:50,790
some sort of things like work or threats, event queues, event loops, again, something we'll cover
87
00:06:50,790 --> 00:06:51,270
later on.
88
00:06:51,480 --> 00:06:59,070
Well, we use the Lib EUV Library and Ryan Doll created these bindings for us that communicates between
89
00:06:59,070 --> 00:07:00,740
V8 and Lib U.V..
90
00:07:02,070 --> 00:07:08,280
So then now we're able to write JavaScript gets read by the V8 engine and then gets sent back to Libya.
91
00:07:08,580 --> 00:07:10,860
But we don't have to worry about what's underneath the hood.
92
00:07:11,100 --> 00:07:13,500
We can just run JavaScript code.
93
00:07:14,010 --> 00:07:14,730
And by the way.
94
00:07:16,050 --> 00:07:19,680
This is exactly how it works with other programming languages as well.
95
00:07:20,100 --> 00:07:24,840
For example, if you wanted to run Python, my computer doesn't know what Python is.
96
00:07:25,110 --> 00:07:28,920
Yes, maybe it might be pre-installed on my computer when I bought it.
97
00:07:29,220 --> 00:07:35,340
But most likely, if I write Python and throw it to the computer, the computer is going to say, Who
98
00:07:35,340 --> 00:07:35,640
are you?
99
00:07:35,910 --> 00:07:36,960
I don't even know what that means.
100
00:07:37,830 --> 00:07:45,060
So just like we will in the next couple of videos, we need to actually install Node.js so that we can
101
00:07:45,390 --> 00:07:50,400
download these tools to run JavaScript outside of the browser in the same way.
102
00:07:50,430 --> 00:07:56,790
If I wanted to, let's say code in Python, I'd have to go to the Python Dawg website and then download
103
00:07:56,910 --> 00:07:57,480
Python.
104
00:07:58,590 --> 00:08:04,260
Or the Python, what we call interpreter, so that my computer can read Python code.
105
00:08:05,250 --> 00:08:06,320
Now let's take a break here.
106
00:08:06,330 --> 00:08:07,740
I know we're covering a lot.
107
00:08:08,190 --> 00:08:10,020
Your brain might be a mush right now.
108
00:08:10,350 --> 00:08:13,320
But don't worry, everything's going to fall into place.
109
00:08:13,530 --> 00:08:14,430
Bit by bit.
110
00:08:15,150 --> 00:08:15,630
For now.
111
00:08:16,020 --> 00:08:18,570
Grab a cup of coffee and I'll see you in the next one.
10923
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.