How can I improve my singly linked list implementation?
"use strict";
var LinkedList = function(){
this.head = null;
this.tail = null;
this.count = null;
}
var Node = function(value){
this.value = value;
this.next = null;
}
LinkedList.prototype.addToHead = function(value){
var newNode = new Node(value);
if(this.head) {
this.next = this.head;
this.head = newNode
this.count++;
}
else this.tail = newNode
}
LinkedList.prototype.addToTail = function(value){
var newNode = new Node(value);
if(this.tail) {
this.tail.next = newNode
}
else this.tail = newNode;
}
var ll = new LinkedList();
ll.addToHead(3);
ll.addToHead(4);
ll.addToHead(2);
ll.addToTail(6);
console.log(JSON.stringify(ll))