API reference@evolu/commonArray › popFromArray

function popFromArray<T>(array: [T, ...T[]]): T;

Defined in: packages/common/src/Array.ts:794

Pops (removes and returns) the last element from a non-empty mutable array.

Mutates the original array.

Example

// Process a stack of callbacks (LIFO)
const callbackStack: Array<() => void> = [callback1, callback2];
if (isNonEmptyArray(callbackStack)) {
  popFromArray(callbackStack)(); // Remove and immediately invoke
}