Methods pop/push, shift/unshift.A queue is one of the most common uses of an array.… It supports two operations:
push adds an element to the end.
pop takes an element from the end.… Methods that work with the end of the array:
pop
Extracts the last element of the array and returns… And what’s with push/pop? They do not need to move anything.… To extract an element from the end, the pop method cleans the index and shortens length.
Both iterables and array-likes are usually not arrays, they don’t have push, pop
When the subcall is finished – the previous context is popped from the stack, and its execution continues… modifications that do not require mass-renumbering are those that operate with the end of array: arr.push/pop
Summary.A cheat sheet of array methods:
To add/remove elements:
push(...items) – adds items to the end,
pop