Today’s class was rushed because the lecture was moving fast, so I made quick notes. Let’s make them more structured and detailed.
- Even/Odd Numbers – Check if a number is even or odd.
- Array of Numbers – Iterate through an array.
- Divisible by 5 – Print numbers divisible by 5.
We started learning how to select and edit HTML elements using JavaScript.
const myHeading = document.getElementById("Heading");
myHeading.textContent = "Manvith";
myHeading.style.color = "white";const myHeading = document.querySelector("#Heading");
myHeading.textContent = "Manvith";
myHeading.style.color = "white";⚡ getElementById still works but querySelector is now the industry standard because it’s more flexible (can select by id, class, tag, etc.).
- Control Flow helps us run conditions (if/else, loops) to decide how scripts behave.
- DOM (Document Object Model) lets us interact with and change HTML elements using JavaScript.
Example:
for (let i = 1; i <= 20; i++) {
if (i % 2 === 0) {
console.log(i + " is Even");
} else {
console.log(i + " is Odd");
}
}We had to:
- Create a heading named Java in HTML.
- Select the element and change it to JavaScript.
- Apply some styling.
- Add Java information.
- Then remove that Java info and add JavaScript info using createElement.
Day15/
│
├── controlflow/ # Notes & practice files for control flow (if-else, loops, switch)
│
├── DOM/ # Notes & practice files for Document Object Model manipulations
│
├── Homework/ # Assigned exercises and completed solutions
│
└── README.md # Summary of Day 15 learning and tasks