- Home
- /
- Tutorials
- /
- JavaScript Tutorial
- /
- JavaScript Function Declarations
JavaScript Functions
JavaScript Function Declarations
A JavaScript function declaration defines a named function using the
functionkeyword.
This is the most common way to create a function.
A declared function can be called from anywhere in the same scope, even from a line above it.
Example
Example
javascript
function double(number) {
return number * 2;
}
console.log(double(8));In this example, double is a function declaration.
The output is 16.
