🔹 1. Introduction to JavaScript
JavaScript is a lightweight, interpreted scripting language used to make websites interactive and
dynamic. It runs directly in web browsers and powers everything from clickable buttons to full web
apps.
> Why JavaScript?
Runs in the browser (no need for installation)
Adds life to static HTML pages
Supports event handling, validation, and animations
Used in both frontend and backend (Node.js)
---
🔹 2. JavaScript Basics
Syntax is case-sensitive
Statements end with ; (optional but preferred)
Runs inside <script> tag in HTML or in .js files
Variables:
let name = "Yuva";
const pi = 3.14;
var age = 20;
Data Types:
String, Number, Boolean, Object, Array, Null, Undefined
, ---
🔹 3. Operators
Arithmetic: +, -, *, /, %
Comparison: ==, ===, !=, >, <
Logical: &&, ||, !
Assignment: =, +=, -=
---
🔹 4. Conditional Statements
if (score >= 50) {
alert("Pass");
} else {
alert("Fail");
}
---
🔹 5. Loops in JavaScript
For Loop:
for (let i = 0; i < 5; i++) {
console.log(i);
}
While Loop:
let i = 0;