Determine if a value is Callable/Constructible

Axel Rauschmayer axel at rauschma.de
Mon Mar 30 08:54:27 UTC 2015


>> ```js
>> class MySuperClass {}
>> 
>> // This function assumes that MySuperClass is an ES5 constructor function
>> function MySubConstructor(foo) {
>>    MySuperClass.call(this);
>>    this.foo = foo;
>> }
>> MySubConstructor.prototype = Object.create(MySuperClass.prototype);
>> MySubConstructor.prototype.constructor = MySubConstructor;
>> ```
> 
> so if MySuperCall didn’t have the throw on [[Call]] behavior the above would work just fine.

In general, I’d expect this kind of subclassing to fail, due to the new instantiation protocol. Wrong?

-- 
Dr. Axel Rauschmayer
axel at rauschma.de
rauschma.de



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.mozilla.org/pipermail/es-discuss/attachments/20150330/00c0bca5/attachment.html>


More information about the es-discuss mailing list