Skip to content

Commit

Permalink
isEmpty
Browse files Browse the repository at this point in the history
  • Loading branch information
falafel-v-postel committed Sep 28, 2017
1 parent e2394e7 commit 812fd93
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions src/linked-list.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,26 @@
const Node = require('./node');

class LinkedList {
constructor() {}

append(data) {}
constructor() {
this._length=0;
this.head=null;
this.tail=null;
}

append(data) {
var node=new Node (data);
if (this._length) {
this.tail.next=node;
node.previous=this.tail;
this.tail=node;
} else {
this.tail=node;
this.head=node;
}
this._length++;

return node;
}

head() {}

Expand Down

0 comments on commit 812fd93

Please sign in to comment.