Welcome back.
It's time to learn Node J.S. now, no, we've kind of used it in previous videos, but we haven't really
explained it.
So throughout this section, we're going to learn what it is and finally use it to build a server.
Now, we may have mentioned this before, but node is JavaScript that runs on your machine.
You see, up until node was created, you could only run JavaScript in the browser because the browsers
were the only ones that had a JavaScript engine like V8.
And no GST was created with the V8 engine in order to be able to run JavaScript anywhere, including
your computer, including our robots and anywhere as long as you had no gas.
And as a matter of fact, we've been using node this entire time in our terminal when we ran commands
that AMPM gave us like Create React app.
Well, that was using Node.
We were running JavaScript outside of the browser.
And no gas is probably the most popular for building servers.
It's really, really fast, and more and more companies are using it now as a backend server because
of the way that it's built.
No gas is probably the server of choice for any web apps or mobile apps out there that want to create
an API or server.
And it's also really, really good at building chat applications and real time communication.
Anyway, as we've mentioned before, you probably should have this on your computer by now, but if
not, you can download Node.js.
I like using the Altius version.
But as long as the version that you're using is higher than eight point nine point three, this demonstration
will work for you.
Notice really, really good at making sure that everything is compatible.
Again, if you're using a Windows operating system, then Node provides that for you in the download
section as well.
And again, to check node, it's very easy, we just do note dash fee to see that we have it.
And if you do have it, you'll have the version number printed for you on the console.
One last thing before I show you some note commands, like I said before, note can be run anywhere.
And one of my favorite things to do with note other than built servers is to actually create robots
using JavaScript.
This Johnny five is a JavaScript library that you can use with Node, and if you have something like
a Raspberry Pi.
It helps you build functions using JavaScript that robots can perform so highly, highly recommended.
After this course, if you want to explore more, Johnny five is one of my favorite things, and it's
surprising how easy it is to build a robot that does whatever you wanted to do just using JavaScript.
But anyway, let's go back to note.
In your terminal, if you actually type in Node and press enter, you'll see that the prompt changes
now.
And I can run node in the terminal if I do console the log.
I get high if I do four plus five.
I get nine and if I do bullion.
Three.
They spell the harangue bullion.
Three, I get true.
As you can see, we're just running JavaScript.
But there is a bit of a difference here.
If I type in window, I get a reference here.
Window is not defined.
And let me clear this a little bit.
This is because when we run node.
We don't have the window object, the window object was provided to us by the browser and as you know,
note, well, there's no browser that's running it.
Instead, note comes with something called global.
And you can see that this global has just like the window object, had a bunch of things that we can
use, but it won't have browser specific things.
For example, we won't be able to have global sport fetch.
It's undefined because, well, it doesn't exist that was provided to us by the browser.
We also don't have the document object.
If you remember, if I do document again, I get a reference error because, well, there's no document,
so that's something to keep in mind.
Node comes with its own properties and methods that we use.
But other than browser specific things, we can do anything we want with note.
One of the global objects that we have is something called process.
If I press enter again, I have a ton of stuff, and in node process means this process, what I'm running
right now in the terminal is the process, what the computer is doing.
All right, and let's just clear this.
Now if I do process Scott exit.
I exit this process, and now I'm back to my terminal.
Now that we have node in our power, we're going to start writing some scripts and show you how we can
start writing actual JavaScript, not in the terminal, but in sublime text.
I'll see you in the next video.
Bye bye.