Symbol.species example from MDN not making sense?

You are missing an important detail. If you subclass array, and then do a map, using Symbol.species you can get back an array, not a member of your derived class. Sometimes you want that, for instance if you are exposing an API as a library author. You may want some special subclass sauce for your internal use but expose methods that return regular arrays for public consumption.

And there’s no real limit, you can set up an alternate constructor for anything at all.

As for why commenting out the line doesn’t change anything, remember that subclassing built-ins is new, may not be fully and correctly implemented, and that this is especially true with node.js where if they jump on the bandwagon early they get stuck supporting something ‘wrong’ for years in an LTS (they got burned on that on Object.observe).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)