!
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>ICD College Web Dev Overview</title>
</head>
<body>
<h1>Welcome to ICD College Web Development Overview</h1>
<!-- JavaScript Section -->
<script>
// This is how we include JavaScript inside an HTML file using <script> tags.
// What is JavaScript?
// JavaScript is a programming language used to make web pages interactive and dynamic.
// JavaScript Output Statements
alert("Hello, this is an alert box!"); // Displays a popup message to the user
console.log("This message is logged in the browser console"); // Prints a message in the browser's
developer console
document.write("This is written directly on the page"); // Outputs content directly to the webpage
// JavaScript Variables
var name = "ICD College"; // Declares a variable 'name' with string value using 'var'
let course = "Web Development"; // Declares a block-scoped variable 'course' using 'let'
const year = 2025; // Declares a constant 'year' which cannot be changed
// JavaScript Operators
let a = 5; // Assigns value 5 to variable 'a'
let b = 2; // Assigns value 2 to variable 'b'
let sum = a + b; // Adds 'a' and 'b', stores result in 'sum'
let product = a * b; // Multiplies 'a' and 'b', stores result in 'product'
console.log("Sum:", sum); // Prints the sum
console.log("Product:", product); // Prints the product
// Conditional Statements
if (a > b) { // Checks if 'a' is greater than 'b'
console.log("a is greater than b"); // Executes if condition is true
} else {
console.log("b is greater than or equal to a"); // Executes if condition is false
// Loop Types
// for-loop
for (let i = 1; i <= 3; i++) { // Repeats loop 3 times
console.log("For loop iteration:", i); // Prints the current loop count
// while loop
let j = 1; // Initializes variable 'j'
while (j <= 3) { // Executes loop while 'j' is less than or equal to 3
console.log("While loop iteration:", j); // Prints the current value of 'j'
j++; // Increments 'j' by 1
// do-while loop
let k = 1; // Initializes variable 'k'
do {
console.log("Do-While loop iteration:", k); // Executes at least once
k++; // Increments 'k'
} while (k <= 3); // Repeats while 'k' is less than or equal to 3
// JavaScript Functions
function greet(name) { // Defines a function called 'greet' that takes one parameter
return "Hello, " + name + "!"; // Returns greeting message with the name
console.log(greet("Student")); // Calls 'greet' function with argument "Student"
// JavaScript Objects & Arrays
// Object Example
let student = {
name: "Ali", // Student name
age: 20, // Student age
course: "Web Development" // Student course
};
console.log("Student Name:", student.name); // Accesses 'name' property of student object
// Array Example
let courses = ["HTML", "CSS", "JavaScript"]; // Defines an array with 3 courses
console.log("First Course:", courses[0]); // Accesses the first item in the array
</script>
</body>
</html>