# 큐 (Queue)

![](https://3218942527-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-LDh9DRX9mY5DxCBhVRu%2F-LDto7Q7deopQxO4bs_6%2F-LDtqjpqPNwJ3dzO7Wlt%2Fimage.png?alt=media\&token=cfb2a6e6-a7c8-4fb1-ae38-d14549a0981e)

* First-In-First-Out (FIFO)

### Javascript Code

```javascript
class Queue {
    constructor() {
        this.dataStore = [];
    }

    enqueue(element) {
        this.dataStore.push(element)
    }

    dequeue() {
        this.dataStore.shift();
    }

    front() {
        return this.dataStore[0];
    }

    back() {
        return this.dataStore[this.dataStore.length - 1];
    }

    empty() {
        return this.dataStore.length === 0
    }

    toString() {
        return this.dataStore.join(' ');
    }
}
```

### Example

* Printer job queue
