So, Deno is a JavaScript runtime and a TypeScript runtime.
And if we go to the Node website, Node is a JavaScript runtime built on the Chrome
V8 JavaScript engine.
So they're both built on this engine, V8 engine.
Sounds pretty cool, but what is it?
Well, a JavaScript engine does exactly that.
It moves our JavaScript that we write ourselves as programmers and spits out
instructions for the machine that it's running on.
So for example, for Google Chrome that uses the V8 JavaScript engine, when it
receives a JavaScript file, it's going to say, oh, I understand JavaScript and this
is what the programmer is trying to tell us.
So it receives the JavaScript file or the
JavaScript code, and then it gives instructions to the browser to say, hey,
this person said to, I don't know, create a dropdown menu or do something or submit
a form or log in a user.
The V8 engine is what understands
JavaScript and it turns our JavaScript code into what we call machine code, ones
and zeros, to give instructions to the computer.
And at the end of the day, that's all
programming is, right?
We write in different programming
languages, but all of them get compiled down to ones and zeros because machines,
computers only understand ones and zeros.
And people create programming languages
as a way for us to easily write code without having to write ones and zeros,
and they build these engines that are able to translate from a human readable
programming language to something that, well, is just ones and zeros to tell a
computer what to do.
So why do we need the V8 engine?
Well, we need the V8 engine because at the end of the day, Deno is essentially a
shell around the Google V8 engine so that we're able to write JavaScript code.
And this V8 engine takes that code and gives instruction to the machine.
Now, Node is also this shell around the V8 engine.
Because the V8 engine is developed by Google, it's really, really good.
It's performant.
It's fast.
It's constantly being updated.
They leverage this constantly updating
engine to read our JavaScript files.
But on top of that, it's a runtime.
So as long as we include Deno or Node .js anywhere on a computer, we can run JavaScript.
But it can also give us extra tools that maybe the V8 engine doesn't give us.
Maybe things outside of JavaScript.
For example, we can use TypeScript.
Deno compiles our TypeScript, changes it to JavaScript, and then feeds it to the
JavaScript V8 engine.
Now this is a simplified version.
But just by looking at this, we should understand that what we need to do next
is to, well, install this runtime so we can start writing Deno code.
Just like we install Node on a machine that we want to run JavaScript, we have
to install Deno to be able to run JavaScript.
That's why we need a runtime.
If I don't have these two things and I write JavaScript code, let's say on a
text file on my desktop, who's going to run it?
My computer doesn't know what JavaScript is.
They're going to say, well, I have no
idea what you're talking about, Andre.
So we need to install Deno.
Now, you might be wondering, why can't I run JavaScript on the browser then?
I mean, I can do simple JavaScript stuff here.
I can say, alert, hi, I'm able to write
JavaScript here.
But I didn't install anything.
And remember what I said before, JavaScript initially was meant for the browsers.
Browsers, when you install Google Chrome, install Safari, Firefox, the Edge
browser, all of these come with the V8 engine built in.
You download them onto your computer.
And when you run this Chrome browser, the
JavaScript engine is running behind.
But if we ever want to run JavaScript
outside the browser like we're going to, well, that's when we need Deno or Node.
And by the way, this is what you do with programming languages.
For example, if you wanted to write Python, which is another programming
language, well, you need to download Python because you need a place that
understands Python and is able to run this Python code.
So you'd go to Downloads, and you'd get the latest version of Python that comes
with things like interpreters to be able to read your code.
All right, enough chatter.
I think it's time for us to download Deno
and write our first Deno application.