What does this access comparison print?

from Arrays and linked lists
Node 24 beginner 3 min

What does this access comparison print?

JavaScript
const array = ["A", "B", "C"];
const head = {
  value: "A",
  next: { value: "B", next: { value: "C", next: null } },
};

let node = head;
let visited = 1;
while (node.value !== "C") {
  node = node.next;
  visited += 1;
}

console.log(`${array[2]} ${node.value} ${visited}`);
Open in playground
Report an error