JavaScript is a versatile, high-level programming language primarily used to create interactive effects within web browsers. It enables developers to build dynamic web pages, control multimedia, animate images, and much more.
It runs on the client side (in the browser), but can also run on the server side with environments like Node.js.

Where JavaScript Fits in Web Development
JavaScript works alongside HTML and CSS:
- HTML: Structures the content on the web page.
- CSS: Styles the visual presentation.
- JavaScript: Adds interactivity and dynamic behavior.
| Technology | Role |
|---|---|
| HTML | Content structure |
| CSS | Design & layout |
| JavaScript | Dynamic behavior & logic |
Basic JavaScript Syntax
JavaScript code consists of statements and expressions. Here's a simple example that outputs text to the browser console:
📌 Deep Dive: Console Output
console.log('Hello, JavaScript!');
💡 JavaScript Execution
JavaScript code is executed line by line by the browser's JavaScript engine when the page loads or when triggered by events.
Embedding JavaScript in HTML
You can add JavaScript directly inside HTML files using the <script> tag:
📌 Deep Dive: Inline Script Example
<script>
alert('Welcome to JavaScript!');
</script>
Quick Knowledge Check
Test what you just learned
Question 1 of 2
Which technology is responsible for adding interactivity to web pages?
Question 2 of 2
Which keyword is recommended for declaring variables that will not be reassigned?
Loading results...