Deep Dive into JavaScript Functions
Functions are a fundamental concept in JavaScript, allowing you to define reusable blocks of code th...
For further actions, you may consider blocking this person and/or reporting abuse
So fun! I love me some functional js.
Check out this neat constructor syntax!
Typically that's called a factory function as it isn't used with the
newoperator.When a function is used as a constructor (i.e. is invoked with the
newoperator) it needs to work with a dynamically boundthiswhich represents the object under construction.Given that arrow function expressions have their
thisstatically bound to the environment that created them only regular function declarations (and regular function expressions) can used as constructors.Check out this neat factory function syntax
Closures are NOT functions. They are the combination of a function bundled together with references to its surrounding state. ALL functions have an associated closure, not just ones created inside others.