mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
fix(curriculam): include initStack in stack implementation requirements (#66846)
Co-authored-by: Venkat <venkat@Venkats-MacBook-Pro.local>
This commit is contained in:
committed by
GitHub
parent
83bf9eb062
commit
04d44aa177
+3
-2
@@ -13,13 +13,14 @@ In this lab, you will implement a stack data structure using functions. A stack
|
||||
|
||||
**User Stories:**
|
||||
|
||||
1. You should have an `initStack` function that returns an object with a `collection` property set to an empty array.
|
||||
1. You should have a `push` function that adds an element to the top of the stack.
|
||||
1. You should have a `pop` function that removes and returns the top element of the stack, or `undefined` if there isn't one.
|
||||
1. You should have a `peek` function that returns the top element of the stack without removing it, or `undefined` if there isn't one.
|
||||
1. You should have a `isEmpty` function that returns `true` if the stack contains no elements, and `false` otherwise.
|
||||
1. You should have an `isEmpty` function that returns `true` if the stack contains no elements, and `false` otherwise.
|
||||
1. You should have a `clear` function that removes all elements from the stack.
|
||||
|
||||
**Note:** Most tests depend on the `push` function. Implement `push` first, as tests for `pop`, `peek`, `isEmpty`, and `clear` require adding elements to the stack.
|
||||
**Note:** Most tests depend on the `initStack` and `push` functions. Implement them first, as tests for `pop`, `peek`, `isEmpty`, and `clear` require adding elements to the stack.
|
||||
|
||||
# --hints--
|
||||
|
||||
|
||||
Reference in New Issue
Block a user