function Lian(data,pre,next){
this.data = data;
this.preNode = pre;
if(this.preNode ){
pre.nextNode = this;
}
this.nextNode = next;
}
//输入链表
Lian.prototype.aaa = function(){
if(this.nextNode){
return this.data.name + this.nextNode.aaa();
}else{
return this.data.name;
}
};
//插入节点
Lian.prototype.bbb = function(node){
if(this.nextNode && this.nextNode.preNode){
this.nextNode.preNode = node;
}
node.nextNode = this.nextNode;
node.preNode = this;
this.nextNode = node;
};
//删除节点
Lian.prototype.ccc = function(){
this.nextNode.preNode = this.preNode;
this.preNode.nextNode = this.nextNode;
};
var q = new Lian({"name": "1"}, null, null);
var w = new Lian({"name": "2"}, q, null);
var e = new Lian({"name": "3"}, w, null);
var Head = q;
console.log(Head.aaa());
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。