Functions
Can have default parameters, no named parameters when calling though
Different ways to call ft change how it interacts with the local scope
Using this
Use the this of the scope that defined it: .bind(this)
or store the context var self = this
or use arrow its
7 Ways to Define Ft
Ft Declaration
Creates isEven variable in current scope that hold ft obj, hoists ft up, and names it useful for debugging
Need a name for recursion
Arrow Ft
Takes
Ft Expression
allows conditional setting of variable
Name informed for debugging using variable that holds it
Named Ft Expression
Name only available in body, and name set as such
Shorthand method definition
Possible on object literals and classes, required in classes
Generator Ft
Can also be used with ft expression, and method
Ft New
This is disgusting don't use, always declared in global scope
Last updated