Advertisement
STANAANDREY

stack class js

Apr 5th, 2021
818
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. class Stack {
  2.     #items = []
  3.     push = element => this.#items.push(element)
  4.     pop = () => this.#items.pop()
  5.     top = () => this.#items[this.#items.length - 1]
  6.     isempty = () => this.#items.length === 0
  7.     mkempty = () => this.#items.length = 0
  8.     size = () => this.#items.length
  9. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement