Java Script
Java Script
DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
</head>
<body>
<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.
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'
// Conditional Statements
} else {
// Loop Types
// for-loop
// while loop
// do-while loop
do {
// JavaScript Functions
function greet(name) { // Defines a function called 'greet' that takes one parameter
return "Hello, " + name + "!"; // Returns greeting message with the name
// Object Example
let student = {
};
// Array Example
</script>
</body>
</html>