- First, I start with implementing the class
Stackwhich is used for the stack. - In order to store the data in the stack, I am using the constructor method to create and initialize the stack. The
datavariable will hold elements to our stack. - The
pushmethod is used to add elements to our stack. - The
popmethod is used to remove the last element from our stack. - The
peekmethod is used to return the last element in the data property (our array). - The
emptymethod is used to check if there are any values in the stack.
alexandracaulea/stack-implementation-in-javascript
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|