Skip to content

alexandracaulea/stack-implementation-in-javascript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Stack implementation in JavaScript

  • 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.

About

Stack implementation in JavaScript

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published