1- A function is defined using the keyword function, followed by name, followed by parentheses containing the arguments of the function, followed by the body of the function with curly brackets.
2- A binding declared with let
is local to the block it is declared in. A binding declared with var
is visible throughout the whole function or throughout the global scope, if it is not in a function.
3-A pure function is a value producting function that can be subsituted with its return value without changing the meaning of the code. A pure function does not product a side effect and does not rely on global binding that may change. When called with the same arguments, it always produces the same value.