Start of main content
Array without last element
Returns all the elements of an array except the last one.
const initial = arr => arr.slice(0, -1);
initial([1, 2, 3]);
More like this
Array destructuring can be leveraged in many different ways. Here's one of them.
Learn how to execute a function for each element of an array, starting from the last one.
Creates an array of elements, ungrouping the elements in an array produced by zip and applying the provided function.