Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Algorithms
class Stack {
constructor() {
this.storage = [];
}
push(val) {
this.storage.push(val);
}
pop() {
this.storage.pop();
}
size() {
return this.storage.length;
}
log() {
console.log(this.storage);
}
}
class Queue {
constructor() {
this.storage = [];
}
push(val) {
this.storage.push(val);
}
pop() {
this.storage = this.storage.slice(1);
}
log() {
console.log(this.storage);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment