Skip to content

Commit 8d805c1

Browse files
committed
reword
1 parent 480ee2b commit 8d805c1

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

lib/stacks.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
class Stack {
22
constructor () {
3-
this.head = {};
3+
this.top = {};
44
this.length = 0;
55
}
66

77
push(data) {
88
let node = {
99
value: data,
10-
prev: this.head
10+
prev: this.top
1111
};
12-
this.head = node;
12+
this.top = node;
1313
this.length++;
1414
return this.length;
1515
}
@@ -19,14 +19,14 @@ class Stack {
1919
return undefined;
2020
}
2121

22-
let value = this.head.value;
23-
this.head = this.head.prev;
22+
let value = this.top.value;
23+
this.top = this.top.prev;
2424
this.length--;
2525
return value;
2626
}
2727

2828
peek() {
29-
return this.head.value;
29+
return this.top.value;
3030
}
3131

3232
height() {

0 commit comments

Comments
 (0)