...
Sign in

Introduction to JavaScript and the Modern Web

Learn what JavaScript is, why it powers the entire internet, and how browsers execute your code.

Share:

Introduction to JavaScript and the Modern Web

Welcome to JavaScript! 🌐

If you have ever clicked a button that opened a pop-up, swiped through a photo gallery on Instagram, watched video recommendations refresh on YouTube without reloading the page, or filled out a shopping cart—you have experienced JavaScript in action.

JavaScript is the undisputed programming language of the internet. It is built directly into every modern web browser on every phone, tablet, and computer on Earth.

By the end of this lesson, you will understand:

  • What JavaScript actually is
  • The 3 Pillars of the Web (HTML, CSS, and JavaScript)
  • Where JavaScript runs (Browsers and Node.js)
  • What a JavaScript Engine (like Google V8) does
  • How to write and run your first line of code

What Is JavaScript?

JavaScript (often abbreviated as JS) is a lightweight, dynamic programming language designed to make web pages interactive and alive.

When the internet was first created in the early 1990s, web pages were completely static—like printed newspaper pages. You could read text and click blue links, but nothing moved, animated, or responded to user input.

In 1995, an engineer named Brendan Eich created JavaScript at Netscape in just 10 days. Today, over 98% of all websites across the globe rely on JavaScript.


The 3 Pillars of the Web 🏛️

To understand JavaScript's role, think of building a modern house or car:

┌─────────────────┬──────────────────┬───────────────────┐
│      HTML       │       CSS        │    JAVASCRIPT     │
│   (Structure)   │     (Style)      │    (Behavior)     │
├─────────────────┼──────────────────┼───────────────────┤
│ The bricks,     │ The paint,       │ The electricity,  │
│ beams, walls,   │ wallpapers,      │ plumbing, lights, │
│ and doors.      │ and aesthetics.  │ and doorbell.     │
└─────────────────┴──────────────────┴───────────────────┘
  1. HTML (HyperText Markup Language): The skeleton. It defines what content exists on the page (headings, paragraphs, buttons, images).
  2. CSS (Cascading Style Sheets): The visual clothing. It controls colors, fonts, spacing, animations, and layouts.
  3. JavaScript: The brain and nervous system. It makes the page react when a human interacts with it—clicking, scrolling, typing, or submitting data.

Everyday Analogy: The Living Robot 🤖

  • HTML: The robot's metal skeleton and chassis.
  • CSS: The sleek metallic paint job and polished design.
  • JavaScript: The robot's computer brain that allows it to walk, talk, recognize voices, and open doors.

Without JavaScript, the web would be a museum of lifeless digital posters!


Where Does JavaScript Run?

For many years, JavaScript ran only inside web browsers.

Today, JavaScript runs almost everywhere:

  1. In the Browser (Client-Side):
    • Google Chrome, Apple Safari, Mozilla Firefox, Microsoft Edge.
    • It manipulates the webpage, handles button clicks, animations, and talks to web servers.
  2. On the Server (Backend - Node.js & Bun):
    • In 2009, Ryan Dahl extracted Google Chrome's V8 JavaScript engine and created Node.js.
    • Now, developers can use the exact same JavaScript language to build backends, databases, APIs, and mobile apps!

How Does the Computer Understand JavaScript?

Computers do not natively understand English words like function or console.log.

Inside your browser sits a high-performance program called a JavaScript Engine:

  • Google Chrome & Node.js: V8 Engine
  • Apple Safari: JavaScriptCore (Nitro)
  • Mozilla Firefox: SpiderMonkey
Your JS Code ──→ JS Engine (Parser & JIT Compiler) ──→ Machine Code ──→ CPU Runs It!

The engine reads your human-readable JavaScript code, compiles it in milliseconds into fast machine instructions, and runs it right on your computer's processor.


Your First Line of JavaScript Code 🚀

In JavaScript, when you want to output a message or inspect a value, you use:

console.log("Hello, ThinkWisely World!");

Let's break this down piece by piece:

  • console: A built-in object provided by browsers and Node.js that gives you access to the debugging terminal.
  • .log(): A method (command) that tells the console: "Print whatever is inside these parentheses to the screen!"
  • "Hello, ThinkWisely World!": A text string enclosed in quotation marks.
  • ; (Semicolon): Signals the end of a statement. (In modern JavaScript, semicolons are often optional, but using them is a great habit to prevent ambiguity!).

[!TIP] Key Takeaways

  • JavaScript is the programming language that makes the web interactive and responsive.
  • Web pages combine HTML (structure), CSS (presentation), and JavaScript (behavior).
  • JavaScript runs natively inside web browsers and on servers using Node.js.
  • The console.log() statement is the universal way to display messages and inspect values.

CheckpointCheckpoint
Question 1 of 3Score: 0/3

Which of the three web technologies is responsible for page behavior, interactivity, and logic?

Lesson Milestone

Finished Reading This Lesson?

Mark this lesson complete. A chapter counts as done once all its lessons are, and that adds to your course progress.

TH

Written by

ThinkWisely Team

Have a Question or Suggestion?

We'd love to hear from you. Drop your thoughts below to help us improve ThinkWisely!