(size)
| 8 | */ |
| 9 | class PriorityQueue { |
| 10 | constructor(size) { |
| 11 | this._size = Math.max(+size | 0, 1); |
| 12 | /** @type {Queue[]} */ |
| 13 | this._slots = []; |
| 14 | // initialize arrays to hold queue elements |
| 15 | for (let i = 0; i < this._size; i++) { |
| 16 | this._slots.push(new Queue()); |
| 17 | } |
| 18 | } |
| 19 | |
| 20 | get length() { |
| 21 | let _length = 0; |