What is JavaScript ?

1.1 What is JavaScript

JavaScript (JS) is the programming language of the web. It makes websites come alive with interactivity, animations, and logic.

If HTML is the skeleton, and CSS is the skin/clothes, then JavaScript is the brain and muscles that give life to the page.

1.2 Why learn JavaScript ?

• Runs directly in your browser — no setup needed.
• Used by all major websites (YouTube, Facebook, Amazon).
• Works on both frontend (browser) and backend (with Node.js).
• Beginner-friendly and one of the most in-demand languages.

1.3 What can JavaScript do ?

• Show alerts and pop-ups.
• Validate user input in forms.
• Change content dynamically without reloading the page.
• Add animations and effects.
• Build games, mobile apps, and full web applications.

1.4 First JavaScript Program

learningJavaScript.html
1<!DOCTYPE html> 2<html> 3<head> 4 <title>JavaScript Example</title> 5</head> 6<body> 7 <h1>Hello, World!</h1> 8 <button onclick="sayHello()">Click Me</button> 9 10 <script> 11 function sayHello() { 12 alert("Hello from JavaScript!"); 13 } 14 </script> 15</body> 16</html>

👉 When you click the button, JavaScript runs the function and shows an alert.

1.5 How JavaScript fits in Web Development

• HTML → Structure (headings, paragraphs, buttons).
• CSS → Style (colors, fonts, layouts).
• JavaScript → Logic & Interactivity (clicks, animations, dynamic updates).

Without JavaScript, web pages would just be static posters. With JavaScript, they become interactive apps. 🚀

1.6 Fun Facts

• JavaScript was created in just 10 days in 1995 by Brendan Eich.
• It was originally called LiveScript, but renamed to JavaScript.
• Despite the name, it has nothing to do with Java!