Let assume we got following class:
class Content extends Array {
delete (index) {
return [...this.slice(0, index), ...this.slice(index + 1)]
}
copy () {
// Create a copy!
}
}
const content = new Content('alpha', 'beta', 'gamma')
const copy = content.copy()
console.log(copy.delete(1)) // ["alpha", "gamma"]
How can we create a copy of an instance of this class?