diff --git a/curriculum/challenges/english/08-coding-interview-prep/data-structures/create-a-stack-class.english.md b/curriculum/challenges/english/08-coding-interview-prep/data-structures/create-a-stack-class.english.md index f595c9421e..d6eedeea1b 100644 --- a/curriculum/challenges/english/08-coding-interview-prep/data-structures/create-a-stack-class.english.md +++ b/curriculum/challenges/english/08-coding-interview-prep/data-structures/create-a-stack-class.english.md @@ -74,6 +74,28 @@ function Stack() {
```js -// solution required +class Stack { + constructor() { + this.collection = []; + } + print(){ + console.log(this.collection); + } + push(val){ + this.collection.push(val); + } + pop(){ + return this.collection.pop(); + } + peek(){ + return this.collection[this.collection.length-1]; + } + isEmpty(){ + return this.collection.length === 0; + } + clear(){ + return this.collection.length = 0; + } +} ```