MCPcopy Create free account
hub / github.com/betomoedano/JavaScript-Coding-Interview-Questions / LinkedList

Class LinkedList

utils/LinkedList.js:1–15  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1class LinkedList {
2 constructor(value) {
3 this.value = value;
4 this.next = null;
5 }
6
7 add(value) {
8 let currentNode = this;
9
10 while (currentNode !== null) {
11 currentNode = currentNode.next;
12 }
13 currentNode.next = new LinkedList(value);
14 }
15}
16
17module.exports = LinkedList;

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected