<!DOCTYPE html>
<html lang="en">
<body>
<script>
function greet() {
console.log("Hello, World!");
}
greet();// Output: Hello, World!
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<body>
<script>
function greet(name) {
console.log("Hello, " + name + "!");
}
greet("AIT");
// Output: Hello, AIT!
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<body>
<script>
function add(a, b) {
return a + b;
}
let sum = add(5, 3);
console.log(sum);
// Output: 8
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<body>
<script>
const multiply = function(a, b) {
return a * b;
};
let product = multiply(4, 2);
console.log(product);
// Output: 8
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<body>
<script>
const divide = (a, b) => {
return a / b;
};
let result = divide(10, 2);
console.log(result);
// Output: 5
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<body>
<script>
function processUserInput(callback) {
let name = "AIT ";
callback(name);
}
processUserInput(function(name) {
console.log("Hello" + name + "!");
});
// Output: Hello, AIT!
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<body>
<script>
(function() {
console.log("This is an IIFE!");
})();
// Output: This is an IIFE!
</script>
</body>
</html>
<!DOCTYPE html>
<html lang="en">
<body>
<script>
function greet(name = "Guest") {
console.log("Hello, " + name + "!");
}
greet();
// Output: Hello, Guest!
</script>
</body>
</html>