Skip to content

Instantly share code, notes, and snippets.

@RomanTurner
Created April 7, 2021 22:21
Show Gist options
  • Save RomanTurner/4aecb1415548ac0c40fdc80b28a48fef to your computer and use it in GitHub Desktop.
Save RomanTurner/4aecb1415548ac0c40fdc80b28a48fef to your computer and use it in GitHub Desktop.
Push in a LL for a Stack
//Push data in the stack
push = (el) => {
//Create a new node
let node = new Node(el),
current;
//Add the new node at the top
current = this.head;
node.next = current;
this.head = node;
this.length++;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment