Returns all elements of an array except the last one.
const queue = ['task-1', 'task-2', 'task-3'] as const;const withoutLast = Arr.butLast(queue);assert.deepStrictEqual(withoutLast, ['task-1', 'task-2']);assert(withoutLast.length === 2); Copy
const queue = ['task-1', 'task-2', 'task-3'] as const;const withoutLast = Arr.butLast(queue);assert.deepStrictEqual(withoutLast, ['task-1', 'task-2']);assert(withoutLast.length === 2);
Returns all elements of an array except the last one.