JavaScript Introduction
Meet JavaScript — the language that runs every modern website, mobile app, and Node.js server.
JavaScript (JS) is a dynamic, interpreted, multi-paradigm programming language created by Brendan Eich at Netscape in 10 days, May 1995. Originally scoped to make web pages interactive, it now powers the front-end, back-end, mobile, desktop, and even edge/IoT layers of modern software.
In simple words:
- JavaScript is the only language that runs natively in every browser — Chrome, Firefox, Safari, Edge.
- Node.js lets the same language run on servers, CLIs, and build tools.
- The npm registry is the largest open-source package ecosystem on earth (3M+ packages).
- Universal reach — every device with a browser is a JavaScript runtime.
- Full-stack with one language — React on the front, Node/Express on the back, even React Native on mobile.
- Massive job market — JavaScript is the most-used language on Stack Overflow's developer survey, year after year.
- Huge ecosystem — React, Vue, Next.js, Express, Tailwind, Vite — all JavaScript-first.
- Easy to start, deep to master — runs straight from a
.htmlfile ornode index.js; advanced topics (async, closures, generators) keep you growing.
| Domain | Real-world Example |
|---|---|
| Front-End Web | Facebook, Instagram, Airbnb, X (built with React) |
| Back-End / APIs | Netflix, PayPal, LinkedIn (built on Node.js) |
| Mobile Apps | Discord, Uber Eats (React Native) |
| Desktop Apps | VS Code, Slack, Figma (Electron) |
| Real-time Apps | Google Docs, Zoom chat, multiplayer games |
| Build Tools | Webpack, Vite, esbuild, Rollup |
| Browser Extensions | Grammarly, AdBlock, Honey |
| Edge / Serverless | Cloudflare Workers, Vercel Edge Functions |
| Feature | JavaScript | Java |
|---|---|---|
| Typing | Dynamic (no type declarations) | Static (typed at compile-time) |
| Runs On | Browsers + Node.js + Deno | JVM (Java Virtual Machine) |
| Compilation | Just-in-time (V8, SpiderMonkey) | Compiled to bytecode |
| Use Case | Web, full-stack, scripting | Enterprise, Android, big-data |
| Created By | Brendan Eich (1995) | James Gosling (1995) |
| Names Are | Coincidence — Netscape branded "LiveScript" → "JavaScript" for marketing | Sun Microsystems, named after Java coffee |
Bottom line: JavaScript is to Java what car is to carpet — they share four letters, nothing else.
javascript// hello.js — run with: node hello.js console.log("Hello, Codekilla!");
Hello, Codekilla!
// hello.js— a single-line comment. Everything after//on a line is ignored.console.log(...)— built-in function that prints text to the DevTools console (in browsers) or stdout (in Node.js)."Hello, Codekilla!"— a string. JS supports'single',"double", and backtick`template`quotes.;— statement terminator. JavaScript inserts these automatically (ASI), but writing them explicitly avoids surprises.
| Environment | How to run |
|---|---|
| Browser DevTools | Press F12 → Console tab → type code → Enter |
| Node.js | node hello.js from the terminal |
| HTML page | <script src="hello.js"></script> in your <body> |
| Online | Use the Codekilla Compiler — zero setup |
- Writing
Console.log(capitalC) — JS is case-sensitive. - Confusing
==(loose equality, type coercion) with===(strict equality). Always use===. - Forgetting
;— JS's automatic semicolon insertion (ASI) bites in subtle cases (e.g.,returnon its own line returnsundefined). - Treating
nullandundefinedas the same — they're different types.
- Hello variations — Print three lines: your name, your city, and the year you were born using three
console.logcalls. Hint: one statement per line. - Template literals — Given
const pi = 3.14159, print"Pi is approximately 3.14"using backticks andpi.toFixed(2). Hint:`text ${expr}`. - Safe defaults — Use
?.and??to greet auserobject that might benullor missing aname. Output"Hi, stranger"when undefined. Hint:user?.name ?? "stranger".
💡 Think Like a Programmer: Always reach for
===over==. The handful of cases where type coercion is helpful aren't worth the bugs the rest of the time.
JavaScript is the ONLY language that runs natively in every browser — Chrome, Safari, Firefox, Edge. Plus Node.js makes it the most-used backend language too (npm = world's largest package registry).
Important. JavaScript is NOT Java. They share only the name — the languages are unrelated. JS was renamed in 1995 as a marketing ploy when Java was hot.
- Created by Brendan Eich at Netscape in 10 days (May 1995)
- Standardised as ECMAScript by ECMA International
- Runs in browsers + Node.js + Deno + Bun + edge runtimes
- Multi-paradigm — OOP, functional, event-driven, procedural
- Open browser DevTools → Console → run
2 + 2. You're now executing JS! - List 5 frameworks/runtimes that use JavaScript (React, Node, Next.js, …).
- Compare 2 jobs on naukri.com with 'JavaScript' vs 'Java' — note the salary differences.
- Bookmark MDN Web Docs (developer.mozilla.org) — it's the JS bible.
- Learn ES6+ syntax first (arrow functions, destructuring, template literals) — modern jobs require it.
- Run JS in your terminal with Node.js — fastest feedback loop.
Quick recap quiz?
We'll generate 5 MCQs from this lesson and check your understanding instantly. Takes ~30 seconds.
Program
console.log("Hello, Codekilla!");