Skip to content

Commit d1931c8

Browse files
committed
short form push assignment for LL stack
1 parent e5a3eff commit d1931c8

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

lib/stacks.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,11 @@ class LinkedStack {
44
this.length = 0;
55
}
66

7-
push(data) {
8-
let node = {
7+
push(data) {
8+
this.topNode = {
99
value: data,
1010
prev: this.topNode
1111
};
12-
this.topNode = node;
1312
this.length++;
1413
return this.length;
1514
}

0 commit comments

Comments
 (0)