All Tracks/lab implement a queue/
Đang tải...
Hướng dẫn thử thách
1 / 1

Implement a Queue

In this lab, you will implement a queue data structure using functions. A queue is a First-In-First-Out (FIFO) data structure where elements are added to the back of the queue and removed from the front. **Objective:** Fulfill the user stories below and get all the tests to pass to complete the lab. **User Stories:** 1. You should have an `enqueue` function that adds an element to the back of the queue. 1. You should have a `dequeue` function that removes and returns the front element of the queue. 1. You should have a `front` function that returns the front element of the queue without removing it. 1. You should have a `size` function that returns the number of elements in the queue. 1. You should have an `isEmpty` function that returns `true` if the queue is empty and `false` otherwise. **Note:** Most tests depend on the `enqueue` function. Implement that one first, as tests for `dequeue`, `front`, `size`, and `isEmpty` require adding elements to the queue.
Vượt qua bài kiểm tra hiện tại để mở khóa bài tiếp theo.
main.js
UTF-8 • Tab Size: 2Kiểm tra bài:⌘↵
Test Output
Thử thách này không có bài test tự động. Hãy quan sát kết quả trực tiếp ở khung Preview.