Git Product home page Git Product logo

albacross's Introduction

Stack - JavaScript task

Expectations

The goal of this task is to create an implementation of stack. We would like it to be initialized as this:

const stack = new Stack()

It should also allow to create a stack with initial values like this:

const stack = new Stack('abc', 123, true)

The stack should implement the following methods:

  • push – pushes a new element on top of a stack
  • pop – removes top element from a stack; if the stack is empty it should return null
  • peek – takes top element from a stack but doesn't remove it
  • swap – swaps position of the top two elements
  • isEmpty – returns boolean based on whether a stack is empty or not

The stack should also implement size property which will return an actual stack size.

Tests

Project contains a set of simple tests. In a working solution all tests should be passing.

To run it first install dependencies:

$ yarn install

To run tests:

$ yarn test

Good luck! Team Albacross

albacross's People

Watchers

Greg avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.