Modern Full-Stack Development


More Useful: Executing JavaScript Source Files



Download 5,64 Mb.
Pdf ko'rish
bet10/107
Sana06.08.2021
Hajmi5,64 Mb.
#140576
1   ...   6   7   8   9   10   11   12   13   ...   107
Bog'liq
Modern Full-Stack Development Using TypeScript, React, Node

 More Useful: Executing JavaScript Source Files
Interacting with Node in CLI (Command-Line Interface) mode like this is fine and dandy, 
but it’s limited. What you really want to do is execute a saved JavaScript file using Node. As it 
happens, that’s easy to do. Create a text file named test.js (it could be anything, but that’s a 
pretty good choice at this point), and type the following code into it (and, of course, save it):
let a = 5;
let b = 3;
let c = a * b;
console.log(`${a} * ${b} = ${c}`);
Figure 1-2.  The rather uppity (though technically accurate) first greeting, proving 
Node is alive
Chapter 1   Server-Side aCtion: node and npM


8
To execute this file, assuming you are in the directory in which the file is located, you 
simply must type this:
node test.js
Press Enter after that, and you should be greeted with an execution, such as the one 
you see in Figure 
1-3
.
Clearly, this little bit of code is unexceptional, but it does demonstrate that Node can 
execute plain old JavaScript just fine. It demonstrates that we’re dealing with at least the 
ES2015 specification as well, being more specific, thanks to the use of let and template 
literals (or string interpolation if you prefer). You can experiment a bit if you like, and you 
will see that Node should run any basic JavaScript that you care to throw at it like this.

Download 5,64 Mb.

Do'stlaringiz bilan baham:
1   ...   6   7   8   9   10   11   12   13   ...   107




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish