node. JS Tutorial 02-Classic Hello World

Source: Internet
Author: User

Objective:

node. js Introduction, installation and configuration, the previous section has been introduced, if there is unclear can also leave a message or directly ask Niang.

This section:

This section focuses on a simple example of node. js, using two methods. This is described below.

In short, this section is very simple. Look down, everybody.

Script mode:

That is, create a new code file, and then use the node command to execute the file with the following steps:

1. Under the E:\NodejsDemo folder, create a new "helloworld.js" file, with the following code:

1 console.log ("Hello world! ");

A very simple sentence, which is the output command often used in browser debugging.

2. Open dos, switch to E:\NodejsDemo, and then run "Node Helloworld.js" to execute the file:

  

Ps: Is there a feeling of déjà vu? Haha, is the execution command in Java similar to this?

Interactive mode:

That is, typing the code directly into DOS is simple:

Open DOS, enter "Node", then go to MySQL-like command line mode:

  

We then enter "Console.log" ("Hello world!") at the cursor. :

  

Summary:

Feel is not very simple to get started, hehe.

In fact. If you feel your JS level is very high, you think that node. js is easy to conquer, then you are wrong.

I can only say: June do not know the depth of water.

The next section describes how to build a node. js http Server.

node. JS Tutorial 02-Classic Hello World

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.