1
var SeatManager = function (n) {7
SeatManager.prototype.reserve = function () {10
if (!this.seat[this.min]) {12
this.min = this.n < this.min ? NaN : this.min + 1;15
this.min = this.seat[this.min];21
SeatManager.prototype.unreserve = function (seatNumber) {22
if (this.min < seatNumber) {23
let pre_inx = this.min;24
let next_inx = this.seat[this.min];26
while (next_inx < seatNumber) {28
next_inx = this.seat[next_inx];31
[this.seat[pre_inx], this.seat[seatNumber]] = [36
[this.seat[seatNumber], this.min] = [this.min, seatNumber];