<!DOCTYPE html>标签:function,head,数据结构,55,next,current,null,data,append From: https://blog.51cto.com/u_15460007/6049344
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>双向链表</title>
</head>
<body>
<script>
function doubleList(){
this.head=null
this.tail=null
this.length=0
function Node(data){
this.data=data
this.prev=null
this.next=null
}
linkedList.prototype.append=function(data){
var newNode=new Node(data)
if(this.length==0){
this.head=newNode
}else{
var current=this.head
while(current.next){
current=current.next
}
current.next=newNode
}
this.length+=1
}
}
</script>
</body>
</html>