JavaScript is one of the core technologies of the modern web.
Together with HTML and CSS, it allows developers to build interactive and dynamic websites.
In this lesson, you will learn what JavaScript is, where it runs, and how it works behind the scenes.
What Is JavaScript?
JavaScript (JS) is a high-level, interpreted programming language used primarily for web development.
It enables dynamic behavior in browsers such as:
- Animations
- Interactive forms
- Real-time updates
- DOM manipulation
- API communication
JavaScript is executed by a JavaScript engine inside your browser.
Examples of engines:
- V8 (Chrome, Node.js)
- SpiderMonkey (Firefox)
- JavaScriptCore (Safari)
How JavaScript Works in the Browser
Every browser contains a JS engine that reads and executes JavaScript code.
The browser environment provides additional APIs such as:
- DOM (Document Object Model)
- BOM (Browser Object Model)
- Fetch API
- Events
JavaScript alone cannot access files or the OS directly — it needs the browser or Node.js environment.
Adding JavaScript to a Web Page
The simplest way to run JavaScript is by using the <script> tag in an HTML file.
Example:
<!DOCTYPE html>
<html>
<body>
<h1>Hello JavaScript!</h1>
<script>
console.log("Hello from JS");
</script>
</body>
</html>The browser executes the JavaScript inside the script tag when the page loads.
Running JavaScript in the Console
Browsers include a Developer Console where you can run JS code directly.
Open DevTools:
- Chrome: Ctrl + Shift + J
- Firefox: Ctrl + Shift + K
- Safari: Enable Developer Menu
Example commands:
console.log("Hello World");
2 + 2
"JavaScript".toUpperCase()This is a great way to test small pieces of code quickly.
Why JavaScript Is Everywhere
JavaScript has become one of the most widely used languages due to:
- Works in every browser
- Large ecosystem (React, Vue, Angular)
- Server-side support via Node.js
- Massive community and learning resources
- Used for web, mobile, backend, desktop apps
It is now possible to build full applications using only JavaScript.
Summary
In this lesson, you learned:
- What JavaScript is
- How it runs in browsers
- What JS engines do
- How to run JS in HTML or the browser console
- Why JavaScript is so important
In the next lesson, we will set up your development environment and start writing real code.