text: // Stack linked list implementation
  class Node {
    constructor(value) {
      this.value = value;
      this.next = null;
    }
  }
  class Stack {
    constructor() {
      this.first = null;
      this.last = null;
      this.size = 0;
    }
  
    // push & pop working from front of linked list (constant time)
    push(val) {
      const newNode = new Node(val);
      if (!this.first) {
        this.first = newNode;
        this.last = newNode;
      } else {
        const temp = this.first;
        this.first = newNode;
        this.first.next = temp;
      }
      return ++this.size;
    }
  
    pop() {
      if (!this.first) return null;
      const temp = this.first;
      if (this.size === 1) {
        this.first = null;
        this.last = null;
      } else {
        this.first = this.first.next;
      }
      this.size--;
      return temp.value;
    }
  }
  const stack = new Stack();
  stack.push('hey');
  stack.push('hello');
  console.log('stack-', stack);
  console.log(stack.pop());
  
  console.log(stack.pop());
  console.log(stack);
  