class Array1 extends Array {
static get [Symbol.species]() {
return Array;
}
}
const a = new Array1(1, 2, 3);
const mapped = a.map((x) => x * x);
console.log(mapped instanceof Array1);
// Expected output: false
console.log(mapped instanceof Array);
// Expected output: true