Array[Symbol.species]advancedclass MyArr extends Array {
static get [Symbol.species]() { return Array }
}
const a = new MyArr(1, 2, 3)
a.map(x => x) instanceof Array // β true (not MyArr)Override Symbol.species to make derived methods return a plain Array instead of the subclass.
You can override Symbol.species in a subclass to control which constructor derived methods use. Returning Array (the base class) makes .map() and .filter() return plain arrays instead of subclass instances.
Challenge: Create PlainResultArray that extends Array but overrides Symbol.species so that .map() returns a plain Array, not a PlainResultArray. Implement mapReturnsPlainArray that returns true when this is verified.
mapReturnsPlainArray() // β true