Returns the given array without the last element.

Type signature

(xs: any[]) => any[]

Examples

pop([1, 2, 3, 4]); // ⇒ [1, 2, 3]
Try in REPL
pop([]); // ⇒ []
Try in REPL

Questions

  • How to get an array without the last element?
  • How to remove the last element from an array?

TypeScript sourceJavaScript source