Definition

A function declaration defines a named function. The function can be called before it is defined due to hoisting.

Syntax

function functionName(parameters) {
    // Function body
}

Example

function greet(name) {
    return `Hello, ${name}!`;
}

// Calling the function
console.log(greet('Prathamesh')); // Output: Hello, Prathamesh!

Use Cases