RSRobince Studio

Linked Lists

A linked list is a chain of nodes. Each node holds a value and a reference to the next node. Unlike an array, there is no index — you follow the chain from the start (the head). Adding to the front is instant because nothing has to shift.

class Node {
  constructor(value) { this.value = value; this.next = null }
}
Try it yourself

Loading editor…

Linked lists shine when you add and remove at the ends a lot. The trade-off: no instant index access — reaching the nth item means walking n steps.