Hi,

My remove function is not working properly, can anyone give my a hand here of what im doing wrong. It is a linked list in javascript. It is adding but not removing the Beginning of the list.

Code:
function List() {
 this.head = {data:null, next:null};
};

List.prototype.add = function(data) {
	 var node = {
	 	data: data,
	 	next: this.head
	 };
	 this.head = node;
};

List.prototype.remove = function() {

	 this.head.data = this.head.next.data;
	   
	  return this.head.data;

};
Code:
var mL = new List();
	mL.add("First Element");
	mL.add("Second Element");

mL.remove()