JavaScript Basics: What It Is and How It Works on the Web

![[JS 강좌] 1강 - JavaScript란 무엇인가? 웹에서 하는 역할과 실행 원리](/uploads/editor/JS-%EA%B0%95%EC%A2%8C-1%EA%B0%95-JavaScript%EB%9E%80-%EB%AC%B4%EC%97%87%EC%9D%B8%EA%B0%80-%EC%9B%B9%EC%97%90%EC%84%9C-%ED%95%98%EB%8A%94-%EC%97%AD%ED%95%A0%EA%B3%BC-%EC%8B%A4%ED%96%89-%EC%9B%90%EB%A6%AC-20260706-f535ba.webp)
What Is JavaScript?
When you start building a website, the first things you learn are HTML and CSS.
HTML creates the structure of a webpage, while CSS handles its visual styling.
However, with just HTML and CSS, you can't create a fully functional website.
For example, these features cannot be implemented using only HTML and CSS:
Opening a menu when a button is clicked
Validating login input fields
Posting comments
Liking a post
Image sliders
Real-time search
Opening pop-up windows
Exchanging data with a server
This is where JavaScript comes in.
You can think of JavaScript as the programming language that brings webpages to life.
The Roles of HTML, CSS, and JavaScript
In web development, these three technologies work together.
Technology | Role |
|---|---|
HTML | Builds the structure of a webpage. |
CSS | Styles the webpage visually. |
JavaScript | Makes the webpage interactive. |
To illustrate, imagine building a house:
HTML is like the skeleton of the house.
CSS is like the wallpaper and interior design.
JavaScript is like light switches, remote controls, and automatic doors—features that actually move or function.
All three are needed to create a fully functional website.
Where Does JavaScript Run?
Many beginners think JavaScript runs on the server.
But standard JavaScript is executed in the web browser.
When you visit a website, the browser downloads HTML, applies CSS, and then runs JavaScript to make the page interactive.
In short,
User visits site
↓
HTML downloaded
↓
CSS applied
↓
JavaScript executed
↓
User interaction begins
This is how a webpage becomes fully functional.
What JavaScript Does
JavaScript handles many tasks beyond just making pages interactive.
Common examples include:
Handling button clicks
Validating input data
Opening and closing menus
Changing images
Toggling dark mode
Posting comments
Liking content
Implementing search features
Adding animation effects
Communicating with servers (AJAX)
Most modern websites rely on JavaScript to function properly.
JavaScript Is a Programming Language
JavaScript isn't just a tool for styling webpages—it's a full-fledged programming language.
This means you'll learn concepts like:
Variables
Conditional statements
Functions
Arrays
Objects
Events
Asynchronous processing
Loops
At first, these terms may seem confusing, but they become natural with practice.
This course will explain these concepts in an easy-to-understand way.
Why Is JavaScript So Popular?
JavaScript is one of the most widely used programming languages today.
The reasons include:
First, it's supported by all major web browsers without requiring additional installation—Chrome, Edge, Firefox, and Safari can run it directly.
Second, its applications are incredibly broad.
JavaScript isn't limited to websites—it's used in many fields including:
Website development
Admin panels
E-commerce platforms
Community sites
Gaming
Mobile apps
Server-side development (Node.js)
Desktop applications
Integrating with AI services
Lately, developers often use a single language for both front-end and back-end development.
How JavaScript Controls Webpages
Browsers parse HTML into a structure called the DOM (Document Object Model).
JavaScript uses this DOM to modify the screen dynamically.
For example:
Changing headings
Altering text color
Hiding buttons
Replacing images
Adding new elements
Removing existing elements
All these changes are made by JavaScript manipulating the DOM.
In Lesson 7, we'll dive deeper into working with the DOM.
JavaScript Code Examples
Let's look at a simple JavaScript example:
alert("Hello!");
This code displays an alert box saying "Hello!" when the page loads.
Another example:
console.log("JavaScript started!");
This code doesn't show anything on screen but prints a message in the browser's developer console, which is commonly used for debugging and testing.
JavaScript Communicates with Servers
In the past, you had to refresh the page to fetch new data from a server.
With JavaScript advancements, it's now possible to fetch only the necessary data without reloading the entire page.
Examples include:
Posting comments
Increasing likes
Autocomplete search suggestions
Real-time notifications
Chat features
Updating post lists in real time
All these features rely on JavaScript communicating with servers.
In Lesson 12, we'll practice using the Fetch API and AJAX to exchange data between PHP and a server.
What Can You Build After Learning JavaScript?
By completing this course, you'll be able to build features like:
Login screens
Input validation for sign-ups
Comment systems
Liking functionality
Search features
Image previews
Modal windows
Toast notifications
File uploads
AJAX-powered forums
Real-time features
We won't just teach basic syntax—we'll guide you through building real-world website features.
Key Takeaways From This Lesson
Todays lesson covered what JavaScript is and how it works.
Here's what to remember:
JavaScript is a programming language that makes webpages interactive.
HTML creates structure, CSS handles styling.
JavaScript powers dynamic features like button clicks and comments.
JavaScript typically runs in the browser, not on the server.
JavaScript controls webpages by manipulating the DOM.
JavaScript can also communicate with servers to exchange data.
Conclusion
While JavaScript might seem challenging at first, it's actually a fun language that gets more enjoyable as you gradually add features.
This course is designed not just to memorize syntax but to help you interact with real webpages and learn naturally through hands-on practice.
In the next lesson, we'll set up your development environment. We'll cover installing VS Code and using Chrome's developer tools—essential steps for the practical exercises ahead.
FAQ
Is JavaScript the same as Java?
No, JavaScript is a different programming language from Java. They share similar names but have no direct relation.
Can I use JavaScript without HTML and CSS?
JavaScript requires HTML to structure content and CSS for styling. It's designed to work alongside both technologies.
Korean Source
This article is an English localization of a Korean-language report from BlogScore. Original: [JS 강좌] 1강 - JavaScript란 무엇인가? 웹에서 하는 역할과 실행 원리