ES6多重inheritance?

有人可以解释下面有效的ES6代码的含义吗?

'use strict'; class first { constructor() { } } class second { constructor() { } } class third extends (first, second) { constructor() { super(); } } 

据我所知,在JavaScript中没有多重inheritance,但该示例中显示的语法不会抛出任何错误(在Node.js 4.3.0),它的工作原理,… – 试图理解,或者它在那里做什么…

另外,我注意到如果我注释掉了super()调用,那么代码开始抛出错误ReferenceError: this is not defined

这只是逗号运算符的混淆。

 (1, 2) // 2 (1, 2, 3) // 3 (first, second) // second 

它不会抛出一个错误,因为它是有效的语法,但是它不起作用。 third只会从second只inheritance。

我们可以通过编译为ES5语法来validation是否是这种情况,以检查它是否不影响类定义。

 var third = (function (_ref) { _inherits(third, _ref); function third() { _classCallCheck(this, third); _get(Object.getPrototypeOf(third.prototype), 'constructor', this).call(this); } return third; })((first, second)); 

评估结果(first, second)作为_ref ,然后从third _inherits