Skip to content

Commit 10c20a3

Browse files
authored
Fix unnecessary parameters in Queue class method and elaborated on explanation (#2025)
Fixes #2019
2 parents abf7537 + 288dd20 commit 10c20a3

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

content/snippets/js/s/data-structures-queue.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ class Queue {
3535
this.items.push(item);
3636
}
3737

38-
dequeue(item) {
38+
dequeue() {
3939
return this.items.shift();
4040
}
4141

42-
peek(item) {
42+
peek() {
4343
return this.items[0];
4444
}
4545

@@ -50,7 +50,7 @@ class Queue {
5050
```
5151

5252
- Create a `class` with a `constructor` that initializes an empty array, `items`, for each instance.
53-
- Define an `enqueue()` method, which uses `Array.prototype.push()` to add an element to the end of the `items` array.
53+
- Define an `enqueue()` method, which uses `Array.prototype.push()` to add an element, `item`, to the end of the `items` array.
5454
- Define a `dequeue()` method, which uses `Array.prototype.shift()` to remove an element from the start of the `items` array.
5555
- Define a `peek()` method, which retrieves the value of the first element in the `items` array, without removing it.
5656
- Define an `isEmpty()` method, which uses `Array.prototype.length` to determine if the `items` array is empty.

0 commit comments

Comments
 (0)