No that would not work either. You want an object that has its
[[Prototype]] set to MyClass.prototype.

On Mon, Feb 16, 2015, 02:55 Marius Gundersen <[email protected]> wrote:

> >>> The purpose would be defining a class whose instances don't have
> Object.prototype on their prototype chain.  If "extends null" doesn't work,
> then I think you'd have to do something like this to achieve the same?
> >>>
> >>>     function NullBase() {}
> >>>     NullBase.prototype = Object.create(null);
> >>>
> >>>     class C extends NullBase {}
> >>>
>
> Can't this be solved by returning a null object from the constructor?
>
> ```js
> class Null{
>   constructor() {
>     return Object.create(null);
> }
> }
>
> class MyClass extends Null{
>
> }
> let foo = new MyClass();
> foo.toString() //ReferenceError
> ```
>
> Marius Gundersen
>
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss

Reply via email to