Biblioteca de cunoștințe

Getting Started with JavaScript and Node.js

JavaScript runs in the browser and, via Node.js, on the server. This guide installs Node.js and runs your first script.

1. Install Node.js (LTS) via NodeSource

curl -fsSL https://deb.nodesource.com/setup_lts.x | sudo -E bash -
sudo apt install -y nodejs

2. Verify the install

node --version
npm --version

3. Write your first script

echo 'console.log("Hello from Node.js");' > app.js
node app.js

4. Core JavaScript concepts

  • Variables: let, const, and (legacy) var
  • Functions: const add = (a, b) => a + b;
  • Arrays & objects: [1,2,3] and { name: "Cloudesta" }
  • Async: async/await and Promises for non-blocking code

Start a new project with npm init -y and add packages with npm install <package>.

Răspunsul a fost util?

0 utilizatori au considerat informația utilă

Powered by WHMCompleteSolution