Make it possible to add objects to LinkedList.

This commit is contained in:
Oleksii Trekhleb
2018-04-09 12:15:28 +03:00
parent cdf72208b3
commit 8c46dbfb6d
10 changed files with 206 additions and 191 deletions

View File

@@ -18,11 +18,15 @@ export default class Stack {
}
push(value) {
this.linkedList.append({ value });
this.linkedList.append(value);
}
pop() {
const removedTail = this.linkedList.deleteTail();
return removedTail ? removedTail.value : null;
}
toString(callback) {
return this.linkedList.toString(callback);
}
}