Clarification on function default param values
claus.reinke at talk21.com
Tue Oct 1 15:16:06 PDT 2013
> Generally variables are brought into scope by an explicitly appearing
> defining occurrence. Two exceptions are the "function" brings into scope
> both "this" and "arguments". These remain in scope until shadowed by a
> nested "function" or by an explicit definition. Note that "this" can never
> be explicitly defined, and "arguments" can only be explicitly defined in
> non-strict code.
> As of ES6, a variety of other function-defining constructs, like
> "function", implicitly bring into scope a new "this" and "argument".
> Arrow-functions are not one of these. Within an arrow function, both "this"
> and "arguments" are lexically captured from the enclosing context.
Also "super" (implicitly bound in "function", available lexically scoped
in arrow function body).
Still following the rule: arrow functions have no implicit bindings and
do not interfere with lexical scope (other than adding explicit bindings
for their parameters).
More information about the es-discuss