Well, in general, he believed that bad practice calls a function using the ternary operator (s) without assigning a return value (this is what you seem to be doing).
In addition, it would be advisable to check what JSHint can say about the following code:
(aFunctionOrNull || someObject.someMethod)();
If aFunctionOrNull is undefined (either zero or false), a boolean or bit will cause the expression to evaluate to someObject.someMethod , and the resulting value of this call (a link to the function object, hopefully). This gives you the opportunity to write your code more "fail-safe" without the main nested triple:
(aFunctionOrNull || someObject.someMethod || function(){})();
The grouped expression is now bound to the true value, so there are no errors.
To avoid JSHint when you are not doing anything with the return value, assign it a variable (which I donβt really like to do) or add a little statement to the mix:
~(aFunctionOrNull || someObject.someMethod || function(){})();//bitwise not !(aFunctionOrNull || someObject.someMethod || function(){})();//logical not, doesn't really matter which one
In the last question: someObject.someMethod really is a function call. More specifically, this is a function object call in the context of someObject .
For those who don't know this: JS functions are objects, and the called context is either explicitly set using the bind method (defined in Function.prototype ) or ad-hoc:
var referenceToMethod = someObject.someMethod; referenceToMethod();
An easy way to think about JS functions simply floating aimlessly in memory / space / time until they are called through a link, the context of that link is then passed to the function object to determine which object it will interact with. This, unfortunately, is the default global object or null in strict mode.