Function Signature (JavaScript)

Functions have a signature, this is how the JavaScript runtime knows what code block to…

How is a function defined in JavaScript?

Functions have a signature, this is how the JavaScript runtime knows what code block to execute when the function is called.

In JavaScript, a global function begins with the word function , followed by the name of the function, and parentheses with an optional list of parameters.

// a function with NO input parameters
function sayHello(){
    console.log('Hello');
}
// a function WITH input parameters
function add(first, second) {
    return first + second;
}

Level: Apprentice · More JavaScript terms at this level

Updated