情况1:添加位置为0时
此时链表的指向可直接指向新添加的节点
情况2:position位置大于1时
此时定义两个变量Current,Previous为保存原来的位置
遍历每个节点 先将previous记录为使得current指向所需操作位置的节点,遍历结束后,将要添加的节点的NEXT指向current,Previous的NEXT 指向添加的节点
function LinkedList(){
function node(data,next){
this.data=data,
this.next=next
}
this.head=null
this.length=0
LinkedList.prototype.append=function(data,next){