JavaScript function keyword
?
The `function` declaration creates a [[(js) binding]] of a new function to a given name.
For example
function calcRectArea(width, height) {
return width * height;
}
console.log(calcRectArea(5, 6));
// 30
This creates a `Function` object. Function declarations are hoisted to the top of the enclosing function or global scope. This means you can call it as long as you define it later.
Redeclaring at the top of a script, functions defined can be reassigned using `var`, but not `let`, `const`, or `class`. Also the `var` initializer overrides the function's value
var a = 1
function a() {}
console.log(a); // 1