Appearance
Returns the object at the top of the Stack<T> without removing it.
Stack<T>
T
The object at the top of the Stack<T>.
const stack = new Stack<number>(); stack.push(1); stack.push(2); stack.push(3); stack.peek() // => 3
This method is an O(1) operation.