mirror of
https://github.moeyy.xyz/https://github.com/trekhleb/javascript-algorithms.git
synced 2024-09-20 15:53:02 +08:00
Refactor peek function in Stack.
This commit is contained in:
parent
c8b3fb9983
commit
114748b876
@ -16,7 +16,7 @@ export default class Stack {
|
|||||||
* @return {*}
|
* @return {*}
|
||||||
*/
|
*/
|
||||||
peek() {
|
peek() {
|
||||||
if (!this.linkedList.tail) {
|
if (this.isEmpty()) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user