mirror of
https://github.com/trekhleb/javascript-algorithms.git
synced 2026-03-13 08:51:02 +08:00
Make it possible to add objects to LinkedList.
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user