In the definition of the LinkedList.forEach function:
LinkedList.prototype.forEach = function(callback) { var node = this.head; while (node) { callback(node.value); node = node.next; } };
Doesn't the node = node.next; line incorrectly refer only to a reference (node.next), rather than an actual node object?
Thanks.