What is a javascript function declaration?
-
Function Declaration
The function declaration is saying what the function is going to do. We later call the function, this is when it gets executed.
Below is a syntax for a function declaration.
function functionName(parameters) {
// code to be executed
}Example of a function declaration.
function myNumbers(a, b) { return a + b; }
Using the function declaration.
let sum = myNumbers(5, 5) console.log(sum) function myNumbers(a, b) { return a + b; }
Result.
10
© Lightnetics 2024