Setting Up — Browser Console, Node.js & VS Code

তিনটি জায়গায় JavaScript চালানো যায় — কোনটা কখন

Read: ~25 min Beginner 4 practice problems Live in-browser runner

1. Three Places to Run JavaScript

JavaScript is unique — it runs in three different environments with the same syntax. Knowing which to pick saves hours.

JavaScript-এর বিশেষত্ব হলো — একই কোড তিনটি ভিন্ন জায়গায় চলে। কাজ অনুযায়ী সঠিক জায়গা বেছে নিতে পারলে অনেক সময় বাঁচে।
EnvironmentBest ForSetup
Browser DevToolsQuick experiments, DOM, fetch, debugging a live pagePress F12 — done
Node.jsServers, scripts, build tools, file workInstall once from nodejs.org
VS CodeEditing real projects with autocomplete, lint, debugFree download, ~150 MB

2. The Browser Console — Zero Install

Every modern browser ships with a full developer toolkit. To open it:

  • Windows / Linux: F12 or Ctrl + Shift + I
  • macOS: Cmd + Option + I
  • Right-click any page → Inspect
  • Switch to the Console tab
যেকোনো ব্রাউজারে F12 চাপলে DevTools খোলে। সেখানে Console ট্যাবে গিয়ে যেকোনো JavaScript লেখা ও তৎক্ষণাৎ চালানো যায় — কোনো ইনস্টল লাগে না।

The console is a full REPL — Read, Eval, Print, Loop. Type any expression, press Enter, see the result.

in-console.js
// Type these one line at a time in the Console tab.
2 + 2;                              // 4
const name = "Bangladesh";
console.log(`Hello, ${name}!`);
Math.sqrt(144);                   // 12
[1, 2, 3].map(n => n * 2);          // [2, 4, 6]
Multi-line input Press Shift + Enter to add a new line in the Console without running. Press Enter to execute.

3. Installing Node.js

Node.js is JavaScript outside the browser — V8 engine glued to file/network/OS APIs. With Node, JS becomes a real systems language: scripts, build tools, web servers.

  • Visit nodejs.org and download the LTS (Long-Term Support) version
  • Run the installer; accept defaults; it adds node and npm to your PATH
  • Open a terminal and verify:
$ node --version
v22.11.0
$ npm --version
10.9.0
Node.js হলো ব্রাউজারের বাইরে JavaScript চালানোর runtime। nodejs.org থেকে LTS version ইনস্টল করুন। এর সাথে npm (package manager) আপনাআপনি ইনস্টল হয়ে যায়।

The Node REPL

Type node alone in the terminal — you get an interactive REPL just like the browser console.

$ node
Welcome to Node.js v22.11.0.
> 2 + 2
4
> const greet = (n) => `Hello, ${n}!`
undefined
> greet("Dhaka")
'Hello, Dhaka!'
> .exit

Running a .js File

Save the snippet below as hello.js and run node hello.js in the same folder.

hello.js
const os = "Bangladesh";
console.log(`Hello from Node.js, ${os}!`);
console.log(`The time is ${new Date().toLocaleTimeString()}`);

4. Installing VS Code

Visual Studio Code is a free, fast, cross-platform editor — the most popular editor on Earth as of 2026, used by millions of JS developers daily.

  • Download from code.visualstudio.com (Windows / macOS / Linux)
  • Install with defaults
  • Open a folder via File → Open Folder…
  • Press Ctrl + ` (backtick) to open the integrated terminal
Recommended Extensions
ExtensionWhy
ESLint (Microsoft)Catches bugs and style mistakes as you type
PrettierAuto-formats code on save — no more arguments about spaces vs tabs
Live Server (Ritwick Dey)One-click local web server with auto-reload
Code RunnerRun any .js file with one keystroke
JavaScript (ES6) snippetsSpeeds up boilerplate (clg → console.log)
VS Code-এ এই ৫টি extension থাকলে আপনি পেশাদার JS পরিবেশ পাবেন। ESLint ভুল ধরবে, Prettier কোড সুন্দর করে দেবে, Live Server browser-এ live preview দেখাবে।

5. Your First Project Folder

Real JS projects all share a tiny, conventional layout. Create one from scratch:

$ mkdir hello-js
$ cd hello-js
$ npm init -y                 # creates package.json
$ echo "console.log('Hi!')" > index.js
$ node index.js
Hi!

You now have a real Node project — same shape used by Netflix, Uber, and your local startup. The package.json file lists your project name, scripts, and (eventually) dependencies.

About node_modules When you start installing packages with npm install <name>, a folder called node_modules appears. Never commit it — add it to .gitignore. The package.json is the source of truth.

6. Picking the Right Tool for the Job

Use the Browser Console when…

  • Trying out a one-liner
  • Debugging a live web page
  • Inspecting the DOM or network
  • You don't have Node installed yet

Use Node + VS Code when…

  • Building anything bigger than 30 lines
  • Working with files or HTTP
  • Using packages from npm
  • Saving the work for later

7. Glossary (শব্দকোষ)

TermMeaningবাংলায়
DevToolsBrowser's built-in developer toolkit (F12).ব্রাউজারের ভেতরের ডেভেলপার টুলকিট। F12 চাপলে খোলে।
ConsoleThe DevTools panel where console.log output appears.DevTools-এর সেই প্যানেল যেখানে console.log-এর output দেখা যায়।
REPLRead-Eval-Print-Loop — interactive prompt that runs code instantly.Read-Eval-Print-Loop — যেখানে কোড লেখার সাথে সাথেই execute হয়।
LTSLong-Term Support release of Node.js — the safe stable version.Long-Term Support — Node.js-এর সবচেয়ে stable সংস্করণ।
npmNode Package Manager — install & manage 3rd-party libraries.Node Package Manager — package install ও manage করার tool।
package.jsonThe metadata + scripts + dependencies file every Node project has.প্রতিটি Node project-এর নাম, script এবং dependency সংরক্ষণকারী ফাইল।
VS CodeMicrosoft's free cross-platform code editor.Microsoft-এর free cross-platform code editor।
ExtensionVS Code add-on (e.g. ESLint, Prettier) that adds features.VS Code-এ অতিরিক্ত feature যোগ করার add-on (যেমন ESLint, Prettier)।
সংক্ষেপে: তিনটি জায়গায় JS চলে — Browser Console (instant test), Node.js (file/server work) এবং VS Code (editor)। প্রথমে Node LTS install করুন, তারপর VS Code, তারপর ESLint + Prettier extension যোগ করুন। এতেই পেশাদার পরিবেশ তৈরি — কোনো paid tool লাগবে না।

8. Practice Problems

Try each on your own first, then click Show Answer to compare and run.

  1. Open your browser DevTools and print three lines: your name, your favourite browser, and the current year — using console.log.
    DevTools খুলে তিনটি লাইন প্রিন্ট করুন — আপনার নাম, প্রিয় ব্রাউজার এবং বর্তমান year।
    ✨ Show Answer (উত্তর দেখুন)
    ans1.js
    console.log("Name: Arif Hossain");
    console.log("Browser: Chrome");
    console.log(`Year: ${new Date().getFullYear()}`);
  2. Use the Node REPL (or this runner) to compute the area of a circle of radius 7. Use Math.PI.
    ৭ একক ব্যাসার্ধ একটি বৃত্তের ক্ষেত্রফল গণনা করুন। Math.PI ব্যবহার করুন।
    ✨ Show Answer (উত্তর দেখুন)
    ans2.js
    const r = 7;
    const area = Math.PI * r * r;
    console.log(`Area = ${area.toFixed(2)}`);

    Output: Area = 153.94। toFixed(2) দশমিকের পর ২ ঘর রাখে।

  3. In one paragraph, explain what exactly Node.js gives you that the browser does not.
    একটি অনুচ্ছেদে ব্যাখ্যা করুন — Node.js আপনাকে browser-এর চেয়ে কী বেশি দেয়।
    ✨ Show Answer (উত্তর দেখুন)

    Answer: Node.js bundles the same V8 engine the browser uses, but adds APIs the browser deliberately blocks for security: filesystem access (fs), child processes, low-level networking (http, net, tls), and a package ecosystem (npm) of more than 2 million libraries. Where the browser is a sandbox for safe execution of untrusted JS, Node is a trusted runtime that can read your disk, open ports, and act like any other systems language. That is why all backend work in JavaScript happens in Node, never in the browser.

    Node.js-এ সেই V8 engine-ই থাকে, কিন্তু সাথে browser-এর বাইরের API থাকে — file পড়া/লেখা, network port খোলা, child process run করা এবং npm-এর ২০ লক্ষ+ package ব্যবহার করা যায়। Browser হলো একটি sandbox যা untrusted code নিরাপদে চালায়। Node হলো trusted runtime — তাই সব backend কাজ Node-এ হয়, browser-এ নয়।

  4. Write a tiny program that prints your operating system platform and Node version (works only in Node, but useful to read).
    আপনার OS-এর নাম এবং Node version প্রিন্ট করার একটি ছোট প্রোগ্রাম লিখুন (এটি Node-এ চলে, browser-এ নয়)।
    ✨ Show Answer (উত্তর দেখুন)

    This snippet only runs inside Node — copy it to info.js and run node info.js:

    info.js
    console.log(`Platform: ${process.platform}`);
    console.log(`Architecture: ${process.arch}`);
    console.log(`Node version: ${process.version}`);

    Output (উদাহরণ): Platform: win32 — Architecture: x64 — Node version: v22.11.0

Summary — Module 02

JavaScript runs in three places: the browser DevTools console (zero install, perfect for experiments), Node.js (server-side, file access, npm), and a code editor like VS Code that talks to both. Install Node LTS once, install VS Code once, install ESLint + Prettier — and you have a professional JavaScript workstation.

JavaScript তিন জায়গায় চলে — Browser Console (কোনো setup ছাড়া), Node.js (server, file, npm) এবং VS Code (editor)। একবার Node LTS এবং VS Code ইনস্টল করে ESLint + Prettier extension যোগ করলেই পেশাদার পরিবেশ তৈরি।

Next Module → Your First Script — console.log, the <script> tag, and your first DOM write.