Stack implementation in JS

by Pritesh Patel

JavaScript

class Stack {
	constructor() {
  	this.data = [];
  }
  push(record){
  	this.data.push(record);
  }
  pop() {
  	return this.data.pop();
  }
  peek() {
  	return this.data[this.data.length - 1];
  }
}