What does this javascript syntax mean ? (0, _parseKey2.default)(something) [duplicate]

This is to give _parseKey2.default the correct this (or, rather, no this at all), that is, to call it as an ordinary function, not a method. Consider:

var p = {
    f : function() {
        console.log(this)
    },
    x : "foo"
};

p.f();      // { f: ... x: foo }
(p.f)();    // { f: ... x: foo }
(0, p.f)(); // implicit global this

The comma expression is a more concise way to do this:

 var unbound = p.f;
 unbound();

Leave a Comment