diff --git a/src/data-structures/stack/Stack.js b/src/data-structures/stack/Stack.js index 7dcd70e4..f9f9d47f 100644 --- a/src/data-structures/stack/Stack.js +++ b/src/data-structures/stack/Stack.js @@ -56,6 +56,14 @@ export default class Stack { .toArray() .map(linkedListNode => linkedListNode.value); } + + /** + * @return {*} + */ + length() { + return this.linkedList + .toArray().length + } /** * @param {function} [callback]