linkedlist javascript
class LinkedList {
value;
next;
constructor(value,next=null){
this.value = value;
this.next = next;
};
}
const root = new LinkedList(10);
root.next = new LinkedList(20);
root.next.next = new LinkedList(30);
console.log(root.next.next);
// Output LinkedList {value: 30, next: null}