Functions
Declarative vs. Dynamic Functions
In JavaScript, functions can be categorized into two main types:
- Declarative/Static Functions: These functions have a fixed structure and are not redefined during runtime.
 - Dynamic/Anonymous Functions: These functions can be evaluated multiple times, and they can be anonymous or dynamically created.
 
Defining Functions
There are different ways to define functions in JavaScript:
- 
Using the Function Constructor:
var variable = new Function("param1", "param2", ..., "paramn", "function body");Functions created with the Function Constructor are parsed every time they are evaluated.
 - 
Using Function Literal:
var func = (params) => { // statements; };This type of function, defined using a function literal, is parsed only once, making it a more efficient way of defining functions.
 
Function Literals
When a function is used within an expression in another statement, it is considered a function literal, regardless of the expression it is used in.
Function Properties
JavaScript functions have certain properties that can be accessed:
- functionName.length: This property returns the number of arguments expected by the function.
 
