- First, I start with implementing the class
Stack
which 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
data
variable will hold elements to our stack. - The
push
method is used to add elements to our stack. - The
pop
method is used to remove the last element from our stack. - The
peek
method is used to return the last element in the data property (our array). - The
empty
method is used to check if there are any values in the stack.
-
Notifications
You must be signed in to change notification settings - Fork 0
alexandracaulea/stack-implementation-in-javascript
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
About
Stack implementation in JavaScript
Topics
Resources
Stars
Watchers
Forks
Releases
No releases published
Packages 0
No packages published