- You can create a function in JavaScript either by assigning the value of a function to a binder, using the keyword function:
let myFirstFunction = function(){
return "Oh Yeah!";
}
or by simply declaring a function:
function anotherFunction(){
return("Here's another function");
}
-
Bindings declared with let are local to the block that they are declared in, whereas bindings declared with var are visible throughout the entire function they are in, or they are global if declared outside of functions. So every time you call the function using the same arguments, it will return the same result.
-
A pure function doesnât rely on side effects from other code, and it has no side effects of itâs own.