当前位置:网站首页>1-1 NodeJS

1-1 NodeJS

2022-04-23 16:58:00 Endless cake

What is? Node?

First of all, we need to correct an idea ,node Not a background language . that node What is it? ?
node Is based on V8 engine ( That is, the engine of Google browser ) Rendering JS Tools or environments .
Use node The following preparation steps are required before :
1. install node
2. take JS Put the code in node In the implementation of

install node

Official website address :https://nodejs.org/zh-cn/
It is recommended that novices download the stable version
After a fool's installation , The computer automatically installed successfully npm(js Module management tool ).
be based on npm You can install and download js modular .
js Encapsulation means that all modules are good , A bag that can be directly retrieved or used by others .

How to be in node Rendering and parsing in js

The first pattern :
REPL Pattern (Read-Evaluate-print-Loop, Input - evaluation - Output - loop )
This mode is very similar to the browser console , It's just that this is implemented in node:
 Insert picture description here
ctrl+c You can execute the end command

Second mode :
Based on the direct Node To execute js
(1) Execute directly through the command window :(DOS window & A terminal window )
Find the file directory , Directly through node xxx.js Can be executed directly js file
 Insert picture description here

(2) Execute directly in the development tool ( I used it here Hbuilder).
 Insert picture description here

版权声明
本文为[Endless cake]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230554520369.html