javascript
\nvar MinStack = function() {\n    this.stack = []\n};\n\n/** \n * @param {number} x\n * @return {void}\n */\nMinStack.prototype.push = function(x) {\n    let m
```\nvar MinStack = function() {\n    this.stack = []\n};\n\n/** \n * @param {number} x\n * @return {void}\n */\nMinStack.prototype.push = function(x) {\n    let min = this.stack.length === 0 ? x : this.stack[this.stack.length - 1].min\n    this.stack.push({val: x, min: Math.min(min, x)})\n};\n\n/**\n * @return {void}\n */\nMinStack.prototype.pop = function() {\n    if(this.stack.length > 0){\n        this.stack.pop()\n    }\n};\n\n/**\n * @return {number}\n */\nMinStack.prototype.top = function() {\n    if(this.stack.length > 0) {\n        return this.stack[this.stack.length - 1].val\n    }\n};\n\n/**\n * @return {number}\n */\nMinStack.prototype.getMin = function() {\n    if(this.stack.length > 0) {\n        return this.stack[this.stack.length - 1].min\n    }\n};\n\n```
[]