A function is a block of code designed to perform a specific task. Functions are used to organize code, make it more modular, and facilitate code reuse.
function function_name(parameter1, parameter2,...) {
// Your code
return value;
}
function_name(arguments...);
// Define a function named "hello"
function hello(name) {
console.log("Welcome, " + name + "!");
}
// Call the function
hello("Coders"); // Output: Welcome, Coders!