Recently, I discovered the power of using fn.apply()
in JavaScript to store function calls with all their arguments intact for future use.
In my specific situation, I don't require the first argument, which is the context (this
), and I want to find a way to exclude passing the this
object altogether while still making it clear in my code that I'm not utilizing .apply()
for that purpose.
Initially, I considered passing in null
, but after reading on MDN:
If the method is a function in non-strict mode code,
null
andundefined
will be replaced with the global object, and primitive values will be boxed.
This leads me to believe that using null
or even false
may not be recommended. What would serve as an appropriately falsy, empty, or otherwise distinct placeholder value to effectively replace the need for the first argument in fn.apply()
?