Why isn't Map subclassable in chrome/node?

前端 未结 4 668
无人共我
无人共我 2021-01-21 06:28

So ES 6 is bringing us Maps (and none too soon). Wishing to subclass Map for my own nefarious purposes, I tried the following (abbreviated for clarity):

function         


        
4条回答
  •  Happy的楠姐
    2021-01-21 06:53

    You should be able to do something like this:

    function Foo() {
        return new (Map.bind(this, [].slice.call(arguments)));
    }
    
    var bar = new Foo();
    

提交回复
热议问题