Function¶
this¶
- global
- window
undefinedin strict mode- function call on object
thisis the object- constructor func
- new instance object
- arrow function
thisis the surrounding scope- call, apply, bind
thisis the first argument
Arrow function¶
- no
this - scope: surrounding scope
- can't be used as constructor
- no
arguments
call, apply, bind¶
call: use rest parametersapply: arraybind: return a new function
IIFE¶
- make a new scope in case of polluting global namespace
IIFE(Immediately invoked function expression)¶
(()=>{
})()