🍄function
🚧 under construction -> named function
JS ⟩ value ⟩ object ⟩ function
an object that can be called (supports the [[Call]] internal method).
its name (or a variable that refers to it) is an identifier.
// function declarations
function f() { ... } // normal function
function* f() { ... } // generator function
async function f() { ... } // async function
async function* f() { ... } // async generator functionIn JavaScript, function arguments are always passed by value. (values of the variables are copied into the function arguments)
👉 JavaScript Tutorial » Understanding JavaScript Pass-By-Value
function vs. constructor
creating functions
using Function constructor
function expression - an expression that evaluates to a function.
IIFE - immediately invoked function expression
types of functions
anonymous function vs. named function 🚧
callback - a function as an argument.
recursive function - a function that calls itself.
accessing functions
function name 🚧
calling functions
features of functions
function scope - scope created by function.
new.target - detect whether a function/constructor was called using new.
function transformers
memoization - make a function "remember" its return values.
other topics
the following are functions:
every method
every class
every constructor (supports the [[Construct]] internal method).
closure can be used as a function with private property (functions/variables)❗(👉 closure: manage grades)
Last updated
Was this helpful?