You asked what is the difference between these two calls:
this.without( this.done() )
vs.
this.without.apply( this, this.done() );
To clarify, remove the nested call to this.done() . Now the first one:
var value = this.done(); this.without( value );
This code explicitly calls this.without() and passes it one argument, regardless of the value returned by this.done() . If value turns out to be an array, the entire array is passed as one argument.
Second version:
var array = this.done(); this.without.apply( this, array );
This calls this.without() with a variable number of arguments, one argument for each array element. (And I called it array instead of value this time, because it makes sense for this code, it must be an array.)
.apply() also sets this in the called function, so passing this because the first argument just passes this along with this function is the same as a regular call to this.without() .
source share