Correctly implemented JavaScript linked list.

Correctly implemented a JavaScript linked list with a head node.