Turning Learners Into Developers
Codekilla
CODEKILLA
back to course
Lesson 01 / 1151%· free preview
Basics1/13

JavaScript Introduction

Meet JavaScript — the language that runs every modern website, mobile app, and Node.js server.

What is JavaScript?

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).
Why Learn JavaScript?
  • 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 .html file or node index.js; advanced topics (async, closures, generators) keep you growing.
What You Can Build with JavaScript?
DomainReal-world Example
Front-End WebFacebook, Instagram, Airbnb, X (built with React)
Back-End / APIsNetflix, PayPal, LinkedIn (built on Node.js)
Mobile AppsDiscord, Uber Eats (React Native)
Desktop AppsVS Code, Slack, Figma (Electron)
Real-time AppsGoogle Docs, Zoom chat, multiplayer games
Build ToolsWebpack, Vite, esbuild, Rollup
Browser ExtensionsGrammarly, AdBlock, Honey
Edge / ServerlessCloudflare Workers, Vercel Edge Functions
JavaScript vs Java — Are They the Same?
FeatureJavaScriptJava
TypingDynamic (no type declarations)Static (typed at compile-time)
Runs OnBrowsers + Node.js + DenoJVM (Java Virtual Machine)
CompilationJust-in-time (V8, SpiderMonkey)Compiled to bytecode
Use CaseWeb, full-stack, scriptingEnterprise, Android, big-data
Created ByBrendan Eich (1995)James Gosling (1995)
Names AreCoincidence — Netscape branded "LiveScript" → "JavaScript" for marketingSun Microsystems, named after Java coffee

Bottom line: JavaScript is to Java what car is to carpet — they share four letters, nothing else.

Your First JavaScript Program
javascript
// hello.js — run with: node hello.js
console.log("Hello, Codekilla!");
Hello, Codekilla!
Line-by-Line Explanation
  • // 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.
Run It Anywhere
EnvironmentHow to run
Browser DevToolsPress F12 → Console tab → type code → Enter
Node.jsnode hello.js from the terminal
HTML page<script src="hello.js"></script> in your <body>
OnlineUse the Codekilla Compiler — zero setup
Common Mistakes
  • Writing Console.log (capital C) — 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., return on its own line returns undefined).
  • Treating null and undefined as the same — they're different types.
Interview Questions

Practice Exercises
  1. Hello variations — Print three lines: your name, your city, and the year you were born using three console.log calls. Hint: one statement per line.
  2. Template literals — Given const pi = 3.14159, print "Pi is approximately 3.14" using backticks and pi.toFixed(2). Hint: `text ${expr}`.
  3. Safe defaults — Use ?. and ?? to greet a user object that might be null or missing a name. 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.

Real-life Example

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.

Key Takeaways
  • 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
Interview Questions

Practice Questions
  1. Open browser DevTools → Console → run 2 + 2. You're now executing JS!
  2. List 5 frameworks/runtimes that use JavaScript (React, Node, Next.js, …).
  3. Compare 2 jobs on naukri.com with 'JavaScript' vs 'Java' — note the salary differences.
Pro Tips
  • 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.
AI-powered recap

Quick recap quiz?

We'll generate 5 MCQs from this lesson and check your understanding instantly. Takes ~30 seconds.

# program

Program

JavaScript
console.log("Hello, Codekilla!");
Ready to move on?
// example library
Want more hands-on snippets in JavaScript?
Browse 2 runnable examples · across 1 chapter · short, copy-paste-friendly · grouped by topic
Explore examples
// side-by-side reference
See this in other languages
Compare the same concept across C, C++, Java, and Python — one table, zero tab-switching.
Compare Languages
// feedback.matters()
Did this lesson help you?