Mark As Completed Discussion

Linked List Implementation

We've covered implementation of a stack with an array, but did you know you can also use a linked list?

Here is another implementation of a stack using nodes of a linked list. We need to start with a Node definition.

1class Node {
2  constructor(data, next = null) {
3    this.data = data;
4    this.next = next;
5  }
6}