// Hypothetical underlying implementation for illustration
class ArrayBuffer {
static get [Symbol.species]() {
return this;
}
}ArrayBuffer[Symbol.species] / notebook
ArrayBuffer[Symbol.species]
Runnable notebook: every JavaScript, HTML and CSS example on this page executes in a sandboxed local frame. Nothing leaves the browser.
class SubArrayBuffer extends ArrayBuffer {}
SubArrayBuffer[Symbol.species] === SubArrayBuffer; // trueArrayBuffer[Symbol.species]; // function ArrayBuffer()class MyArrayBuffer extends ArrayBuffer {
// Overwrite MyArrayBuffer species to the parent ArrayBuffer constructor
static get [Symbol.species]() {
return ArrayBuffer;
}
}