Implementing Stacks & Queues
What encapsulation pattern is demonstrated in this Stack implementation?
class Stack {
#items = [];
push(element) {
this.#items.push(element);
}
pop() {
return this.#items.pop();
}
peek() {
return this.#items[this.#items.length - 1];
}
}