The comma is explained in What does the comma do in JavaScript expressions? . basically, it evaluates all the expressions and returns the value returned by the last.
Probably the reason for using this method is that you can call the method as if it were not a method.
Consider this function:
function f() { return this; }
And make it a way:
var o = {f: f}
Then, although f === of , the result will depend on what you call it:
of(); // o f(); // global object (in non-strict mode) f(); // undefined (in strict mode)
So babel uses a semicolon approach to get a link to a function without binding it to an object. Thus, the method can be called as if it were a global function, not being one of them.
(0, of)(); // global object (in non-strict mode) (0, of)(); // undefined (in strict mode)
source share