Programming Concepts — Linked List
A linked list is a linear data structure where elements (nodes) are connected using pointers, allowing dynamic memory allocation and efficient insertions/deletions.
class Node {
constructor(value) {
this.value = value;
this.next = null;
}
}
const head = new Node(1);
head.next = new Node(2);
head.next.next = new Node(3);
console.log(head.next.value); // Output: 2