- Hands-On Serverless Computing
- Kuldeep Chowhan
- 328字
- 2021-08-05 10:35:39
Node.js tutorial in VS Code
In this section, we will look into how we can write Node.js code in Visual Studio Code. We will also be looking at how to run Node.js code. Visual Studio Code has out-of- the-box support for the Node.js JavaScript language and also has support for Node.js debugging. To demonstrate this, we will create a file, Node.js, which will print Hello Reader!:
Hello Reader!
Let's get started by creating a Node.js file to print Hello Reader!.
Create an empty folder called scratch, navigate into it, and open it with Visual Studio Code:
mkdir scratch
cd scratch
code .
From the File Explorer toolbar, press the New File button:

Name the file hello-readers.js :

Set the extension of the file to .js and, by using the .js file extension, Visual Studio Code will interpret this file as JavaScript and will evaluate the contents with the JavaScript language service.
Create a simple string variable in hello-readers.js and print the contents of the string to the console:
const message = 'Hello Readers!';
console.log(message);
If you take a close look, when you typed console. in Visual Studio Code IntelliSense, (https://code.visualstudio.com/docs/editor/intellisense), the console object was automatically presented to you with one of the options being .log. When editing JavaScript files, Visual Studio Code will automatically provide you with IntelliSense for the DOM:

Also notice that Visual Studio Code knows that message is a string based on the initialization to 'Hello Readers!'. If you type message, you'll see IntelliSense showing all of the string functions available on message:

After experimenting with IntelliSense, revert any extra changes from the source code example above and save the file (cmd + S).
- Internet接入·網絡安全
- Mastering Matplotlib 2.x
- 人工免疫算法改進及其應用
- 錯覺:AI 如何通過數據挖掘誤導我們
- 計算機控制技術
- 精通Excel VBA
- Docker High Performance(Second Edition)
- Prometheus監控實戰
- Enterprise PowerShell Scripting Bootcamp
- OpenStack Cloud Computing Cookbook
- 空間站多臂機器人運動控制研究
- 液壓機智能故障診斷方法集成技術
- 水晶石影視動畫精粹:After Effects & Nuke 影視后期合成
- Photoshop CS5圖像處理入門、進階與提高
- Mastering DynamoDB