* Return the back element without removing it, or `undefined` if the deque * is empty. * * @example Peeking at the back * ```ts * import { Deque } from "@std/data-structures/deque"; * import { assertEquals } from "@std/assert"; * * const deque = new Deque([1, 2, 3]); * ass
()
| 453 | * @returns The back element, or `undefined` if empty. |
| 454 | */ |
| 455 | peekBack(): T | undefined { |
| 456 | if (this.#length === 0) return undefined; |
| 457 | return this.#buffer[(this.#head + this.#length - 1) & this.#mask]; |
| 458 | } |
| 459 | |
| 460 | /** |
| 461 | * Return the element at the given index (0-based from front). Negative |