Node.js is a JavaScript runtime built on Chrome's V8 JavaScript engine. It allows you to run JavaScript outside of a browser. Node.js is used for server-side programming, building command-line tools, and more.

Getting Started

Here's a simple "Hello, World!" example in Node.js:

console.log('Hello, World!');

To run this code, you need to have Node.js installed on your machine. You can download and install it from the official Node.js website.

Features

  • Non-blocking I/O: Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient.
  • Asynchronous Programming: Node.js uses asynchronous programming which allows you to handle multiple operations at the same time.
  • Large Community: Node.js has a large and active community, which means you can find a lot of resources and support.

Install Node.js

To install Node.js, follow these steps:

  1. Download the installer from the official Node.js website.
  2. Run the installer and follow the prompts.
  3. After installation, open a terminal and run node -v to check if Node.js is installed.

Hello, World! Example

Here's a simple "Hello, World!" example:

console.log('Hello, World!');

To run this code:

  1. Open a text editor and paste the code above.
  2. Save the file with a .js extension, for example, hello.js.
  3. Open a terminal, navigate to the directory where you saved the file, and run node hello.js.

You should see the message "Hello, World!" printed in the terminal.

Learn More

If you're interested in learning more about Node.js, check out the Node.js documentation.

Node.js Logo