Why is (0,obj.prop)() not a method call?
This blog post explores references , a mechanism used by the ECMAScript language specification to explain the difference between the following two expressions: obj.prop() (0, obj.prop)() Method calls versus function calls Consider the following object: var obj = { getThis: function () { "use strict"; return this; }, }; If you call obj.getThis , you have a method call ( this points to the object in which the method is stored): > obj.getThis() === obj true If you store obj.getThis in a variable and then call it, you are making a function call: > var func = obj.getThis; > func() undefined The effect is the same if you use the comma operator. Quick recap – the comma operator works like this: (expr1, expr2) === expr2 That is, both expressions are evaluated, the result of the whole expression is expr2 . If you apply the comma operator to obj.getThis before calling it, you are also making a f...