SOURCE

var LikedList = function(){
  //链表头
  var head = null
  //链表长度
  var length = 0
  //链表节点
  var Node = function(element){
    this.element = element;
    this.next = null
  }
  this.append = function(element){
    var node = new Node(element)
    var current;
    if(head === null){
      head = node
    }else{
      current = head;
      while(current.next){
        current = current.next;
      }
      current.next = node;
      
    }
    length++;
    console.log(current)
  }
  //插入节点
  this.insert = function(position,element){
    var node = new Node(element);
    var current = head;
    var previous;
    var index = 0;
    console.log(current)
  }
  this.getHead = function(){
    return head
  }
}
console 命令行工具 X clear

                    
>
console