All language subtitles for 004 Using Node.js_en

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranรฎ)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

So now that you've successfully installed a node, let's go ahead and see how we can use it to start

creating applications.

Now the first thing we're going to do is to perform a version check using this command in the command

line node space, Dash V, go ahead and open up Visual Studio code and open up a new window.

Now, in this new window, you won't have any files, you won't have anything else.

But that's not important.

We're going to go to view and we're going to open up the terminal.

Now, another way to get to this is actually to hover down right to the bottom until you see this little

arrow pop up.

And if you click and drag it up, you'll also be able to open up the terminal.

I'm going to get rid of anything that I don't need.

And inside my terminal, I'm going to write that command Node V to check the version of Node and hopefully

you're on the same version as me.

If you've completed all of the installation steps correctly.

Now, if you don't see the same version, it might be because you are on a more recent version, so

maybe the number is higher.

Alternatively, maybe you've installed Node in the past and you've got a lower version for some reason

or other.

Have a look at the text and the fix in the last lesson where we did the installation and you'll find

some instructions on how to fix this.

But hopefully when you check your node version, you should see a version number show up, starting

with a V and it should be 18 or higher.

So 19, 20, whatever it may be.

Now that we've made sure that we've got the right version of Node, the next thing to learn to use is

the node Repl.

So Repl stands for read eval print loop.

And this is not unique to Node.

It's something that we can do with most programming languages and it's basically an environment like

the node runtime environment where we can put in user inputs in the form of code.

And what we write is read by the computer and evaluated line by line, and then it prints out the result

back to us in the command line or in the console and to initiate the node.

Repl all we have to do is to type the command node going back to our Visual Studio window, let's go

ahead and type the node command here.

It should tell you, welcome to Node and you should see this little arrow here which tells you that

you have successfully entered the node repl Now in the node repl what we're going to do is we can type

some commands such as the help that they've already told you about and this gives you some of the other

commands that you can use.

For example, Break Clear Editor ET cetera.

But the most important one, because very often the hardest thing with Repls is how to exit them.

We can use the dot exit to get out of this and you can see we no longer have that little arrow sign

showing up anymore.

That's ended.

Alternatively, you can simply type control C and then control C again in order to exit.

Now, control C is usually the way to get out of anything in the command line.

So in the future, even if you see some sort of process running and you're not getting your usual command

line interface, just try Ctrl C a few times and that should hopefully get you out of trouble.

Now let's go back into the node Repl and I'm just going to raise this window up a little bit because

I know that very often the subtitle goes at the bottom and it can be hard for students to read what

I'm writing.

All right, so inside our node Repl, let's try to do a read eval print loop, let's write some code,

let's do something really simple like five plus eight hit enter and you can see it's read my code,

it's evaluated it and then it's printed it out.

So read, evaluate, print loop done.

Now remember that Node is a JavaScript runtime, so you can write anything that is JavaScript.

So let a equals three and then a plus 12 will work just as you would expect.

Have a play around with the node Repl and hopefully by the end you'll see that this is really similar

to what you've been able to do using the JavaScript console in the browser.

But in this case we've just taken it out of the browser and we're using Node to enable us to run that

JavaScript code.

Now the final thing I want to show you in terms of using Node JS is how we can write a JavaScript file

and use node to run the entire file.

Because as useful as a ripple is in the command line, what we actually need to do is to write full

code files and to use Node as the runtime environment.

So head over to the course resources in this lesson and hopefully you'll see a zip file there called

2.1 using Node.

And I want you to download and extract that file and open that folder inside vs code.

If you don't know how to access the course resources or how to unzip and actually get hold of the file

and make it work.

And if you've just skipped to this section, make sure you take a look at one of the earliest lessons

in the course right at the beginning in Section one, where we talk about how to get hold of the course

resources, it's really important.

And if anything doesn't work in the next steps, be sure to review that.

All right.

But hopefully you've got this working and you can see in here all there is, is just a blank index.js

file.

But what's important is our folder structure.

I want to show you how we can write code into this code file.

I'm just going to write console log.

Hello from Node and that's all we got.

Let's hit save and let's open up our terminal.

And the first thing I want to do is to navigate to that folder.

So remember, we can use CD to change directory.

And the directory I want to get hold of is the one that contains this index.js file.

So I'm going to drag that folder to point one using node and then hit enter in order to navigate into

that folder in the command line.

Now that I'm here, I can use the node command and instead of just writing Node where we enter the Repl,

I'm going to type in the name of my file.

And one of the things that a lot of developers do when they are trying to access different files etcetera,

is you can actually just type the first few words, hit the tab key on your keyboard and it should autofill

the rest of the file name.

On one hand, this is really great because you didn't have to type out the rest of the file name, but

on the other hand, it's also a sense check for figuring out whether if you're in the right directory,

because if I went up one level and I did the node index and you can see even if I keep hitting tab,

nothing happens.

There isn't a file called that in this directory.

So let's go back into the folder that we want to be in and then go ahead and use Node and then add the

name of the file We want to run, hit enter and you can see that Node has found this file, used the

node runtime to run the code inside Index.js.

And here we see the outcome, which is exactly what we would expect.

There you have it.

Hopefully this has worked just as well for you.

And if you want some extra practice, I recommend creating another JavaScript file inside the same folder

and write some code in there and use node to run that file just so you can have practice using node.

But in the next lesson, we're going to move on to look at some of the native node modules and see how

we can leverage them in order to add more power to our node applications.

For all of that and more, I'll see you there.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.