JavaScript two stacks easy to understand
\nclass BrowserHistory {\n    constructor(homepage) {\n        this.backArr = [homepage];\n        this.forwardArr = [];\n    }\n    visit(url) {\n        this.
```\nclass BrowserHistory {\n    constructor(homepage) {\n        this.backArr = [homepage];\n        this.forwardArr = [];\n    }\n    visit(url) {\n        this.forwardArr = [];\n        this.backArr.push(url);\n    }\n    back(steps) {\n        while(steps && this.backArr.length > 1) {\n            this.forwardArr.push(this.backArr.pop());\n            steps--;\n        }\n        return this.backArr[this.backArr.length - 1];\n    }\n    forward(steps) {\n        while(steps && this.forwardArr.length) {\n            this.backArr.push(this.forwardArr.pop());\n            steps--;\n        }\n        return this.backArr[this.backArr.length - 1]\n    }\n}\n\n```
['Stack', 'JavaScript']