Original solution of Data Structures: Remove Elements from a Linked List

Tell us what’s happening:

Please explain me someone the original solution of this task.
It doesnt make any sense to me. How can he rewrite a variable and modify the head variable, when he just copied content of that variable into the currentNode variable? ???

this.remove = function(element){
    var currentNode = head;
    var previousNode;

    if(currentNode.element === element) {
      head = currentNode.next;
    } else {
      while(currentNode.element !== element) {
        previousNode = currentNode;
        currentNode = currentNode.next;
      }
      previousNode.next = currentNode.next;    
    }
    length --;
  };

Why exactly it doesn’t make sense?

Notice that currentNode.next is assigned to head. This makes head point now to the node that was the next node.

Keep in mind also that content of head is not copied to currentNode, when

var currentNode = head;

is written both these variables are pointing to the same object, but no actual copying happens.