I disagree about call and apply though. I prefer to never use:
new
this (one exception)
Object.create
bind
call
apply
When I avoid this list my code tends to be smaller and faster to execute. You don't need OOP in this language, thanks to lexical scope, to achieve decomposable reuse and reference sharing.
The one exception for this is event handlers where it is commonly necessary to access the event target without access to an explicit reference.
You are being silly. You don't need to specify arguments or an explicit return value to achieve functional programming. Functional programming is not about using functions to pass things around (as a substitute for objects). It is about organizing instructions into containers that can be executed without regard for a returned value.
I don't use call or apply because they are unnecessary. I don't use the arguments array in functions. arguments is generally considered very bad form, because it allows use of arguments with flexibility to types and quantity of arguments passed into the function. This is makes it hard for the JIT compilers to compile those functions, which means the code will execute far more slowly.
-1
u/[deleted] Mar 09 '15
I disagree about call and apply though. I prefer to never use:
new
this (one exception)
Object.create
bind
call
apply
When I avoid this list my code tends to be smaller and faster to execute. You don't need OOP in this language, thanks to lexical scope, to achieve decomposable reuse and reference sharing.
The one exception for this is event handlers where it is commonly necessary to access the event target without access to an explicit reference.