/js-challenges

Primary LanguageJavaScriptGNU General Public License v3.0GPL-3.0

Coding-Challenges

Friday Challenge : 01

DEFINE A STACK DATA STRUCTURE USING JAVASCRIPT WITH THE FOLLOWING MEMBERS

const stack = new Stack() 
stack.push(item) 
stack.pop() 
stack.count()
stack.peek() // Read the top item

CONDITIONS:

  • count should not be an instance member
  • push, pop, peek methods should be prototype members
  • Do the proper error handling

ANSWER:

npm run run:challenge1

UNIT TEST

npm run test:challenge1

Friday Challenge : 02