PAGE 1 – Introduction to JavaScript
JavaScript is a programming language used to make websites interactive.
While HTML gives structure and CSS gives design, JavaScript adds functionality.
PAGE 2 – How to Add JavaScript
JavaScript can be added in three ways:
1. Inline
2. Internal
3. External (Best Practice)
<script>
[Link]("Hello World");
</script>
PAGE 3 – Variables
Variables store data.
let name = "Faisal";
const age = 25;
var city = "Dhaka";
Use let and const in modern JavaScript.
PAGE 4 – Data Types
Common Data Types:
String, Number, Boolean, Array, Object, Null, Undefined
let text = "Hello";
let number = 10;
let isTrue = true;
PAGE 5 – Functions
Functions perform tasks.
function greet(name) {
return "Hello " + name;
}
greet("Faisal");
PAGE 6 – Conditional Statements
let age = 18;
if (age >= 18) {
[Link]("Adult");
} else {
[Link]("Minor");
}
PAGE 7 – Loops
for (let i = 0; i < 5; i++) {
[Link](i);
}
Loops repeat code multiple times.
PAGE 8 – DOM Manipulation
JavaScript can change HTML content.
[Link]("demo").innerHTML = "Hello World";
PAGE 9 – Events
Events respond to user actions like clicks.
[Link]("click", function() {
alert("Button clicked!");
});
PAGE 10 – Best Practices
✔ Use meaningful variable names.
✔ Keep code organized.
✔ Avoid global variables.
✔ Comment your code.
✔ Practice regularly.